<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Sculpt</title>
	<atom:link href="http://sculpt.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sculpt.wordpress.com</link>
	<description>Professional Excel development</description>
	<lastBuildDate>Tue, 10 Apr 2007 20:31:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sculpt.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Sculpt</title>
		<link>http://sculpt.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sculpt.wordpress.com/osd.xml" title="Sculpt" />
	<atom:link rel='hub' href='http://sculpt.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Get values by looping through an array variable</title>
		<link>http://sculpt.wordpress.com/2007/01/26/get-values-by-looping-through-an-array-variable/</link>
		<comments>http://sculpt.wordpress.com/2007/01/26/get-values-by-looping-through-an-array-variable/#comments</comments>
		<pubDate>Fri, 26 Jan 2007 00:35:01 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[array variable]]></category>
		<category><![CDATA[command bars]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/26/get-values-by-looping-through-an-array-variable/</guid>
		<description><![CDATA[When we added a custom command bar we hard-coded our values for the dropdown control. In reality, we&#8217;d want to avoid this: hard-coding would reduce the life-span of the workbook and make it very inflexible. This example demonstrates a simply way of looping through a static array variable to retrieve the values. It assumes we [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=47&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When we added a <a href="http://sculpt.wordpress.com/2006/12/30/add-a-custom-command-bar/">custom command bar</a> we hard-coded our values for the dropdown control. In reality, we&#8217;d want to avoid this: hard-coding would reduce the life-span of the workbook and make it very inflexible.</p>
<p><span id="more-47"></span>This example demonstrates a simply way of looping through a static array variable to retrieve the values. It assumes we simply want to use the initial 5 items for our dropdown &#8211; this can be amended as required. The example also contains hard-coded array bounds (1 to 5) &#8211; when developing a workbook, these should not be hard-coded for the same reasons we mentioned above.</p>
<p>The code below declares a static array variable, looping through the array, getting our values from a the &#8216;Data&#8217; worksheet, then adding each value to the items in dropdown Cmb.<br />
_______________________________<br />
Sub GetValues(Cmb)</p>
<p>Dim iIndex(1 To 5) As String &#8216;Declares the static array variable<br />
Dim iCount As Integer<br />
For iCount = 1 To 5<br />
iIndex(iCount) = _<br />
Format(ThisWorkbook.Worksheets(&#8220;Data&#8221;).Cells(iCount, 1), &#8220;Mmmm yyyy&#8221;)<br />
With Cmb<br />
.AddItem iIndex(iCount) &#8216;, iCount<br />
End With<br />
Next iCount</p>
<p>End Sub<br />
_______________________________</p>
<p>To get these values into the Custom Command Bar, we&#8217;ll slightly amend our code from earlier. We&#8217;ll replace our hard-coded values with Call GetValues(Cmb) code &#8211; this will retrieve the values for each item from the code above.</p>
<p>_______________________________</p>
<p>Sub CustomToolbar()</p>
<p>Dim cbar As Object<br />
Dim Cmb As Object<br />
Dim SubMenu As Object<br />
Dim NewCb As Object<br />
Dim SubMenu1 As Object<br />
Dim SubMenu2 As Object<br />
Dim SubMenu3 As Object</p>
<p>On Error Resume Next</p>
<p>Set cbar = CommandBars.Add(Name:=”Sculpt”, Position:=msoBarTop, Temporary:=True)<br />
cbar.Visible = True<br />
cbar.Enabled = True</p>
<p>Dim NewMenu As Object<br />
Set NewMenu = CommandBars(”Sculpt”)<br />
With NewMenu<br />
.Visible = True<br />
.Enabled = True<br />
.Controls.Add(Type:=msoControlPopup, before:=1).Caption = “Sculpt”<br />
.Controls.Add(Type:=msoControlDropdown, before:=2).Caption = “Select period”<br />
.Controls.Add(Type:=msoControlButton, before:=3).Caption = “Get data”<br />
End With<br />
‘Add Sub Menus to Sculpt</p>
<p>Set SubMenu = CommandBars(”Sculpt”).Controls(”Sculpt”)<br />
With SubMenu<br />
.TooltipText = “Select for further options”<br />
.Controls.Add(Type:=msoControlPopup, before:=1).Caption = “Print”<br />
.Controls.Add(Type:=msoControlButton, before:=2).Caption = “Get Budgets”<br />
End With</p>
<p>Set Cmb = CommandBars(”Sculpt”).Controls(”Select period”)<br />
With Cmb<br />
.Width = 120<br />
.Visible = True<br />
.Enabled = True</p>
<p>‘Get the values for the dropdown from GetValues(Cmb)<br />
Call GetValues(Cmb)<br />
.ListIndex = 1 ‘Item to display in the dropdown list</p>
<p>‘.OnAction = “‘” &amp; ThisWorkbook &amp; “‘!SubName”<br />
End With</p>
<p>Set NewCb = CommandBars(”Sculpt”).Controls(”Get Data”)<br />
With NewCb<br />
.Visible = True<br />
.FaceId = 7433<br />
End With</p>
<p>‘Now add sub-menu items<br />
Set SubMenu1 = CommandBars(”Sculpt”).Controls(”Sculpt”).Controls(”Print”)<br />
With SubMenu1<br />
.Controls.Add(Type:=msoControlButton, before:=1).Caption = “All Records”<br />
.Controls(”All Records”).FaceId = 109<br />
.Controls.Add(Type:=msoControlButton, before:=2).Caption = “Active Records”<br />
.Controls(”Active Records”).FaceId = 928<br />
End With</p>
<p>Set SubMenu2 = CommandBars(”Sculpt”).Controls(”Get data”)<br />
With SubMenu2<br />
.OnAction = “‘” &amp; ActiveWorkbook.Name &amp; “‘!SubName”<br />
End With</p>
<p>Set SubMenu3 = CommandBars(”Sculpt”).Controls(”Sculpt”).Controls(”Get Budgets”)<br />
With SubMenu3<br />
.OnAction = “‘” &amp; ActiveWorkbook.Name &amp; “‘!SubName”<br />
End With</p>
<p>‘Begin groups<br />
Application.CommandBars(”Sculpt”).Controls(”Sculpt”) _<br />
.Controls(”Get budgets”).BeginGroup = True</p>
<p>Set NewMenu = CommandBars(”Sculpt”)<br />
With NewMenu<br />
.Protection = msoBarNoChangeVisible ‘Stops the user from deleting the command bar</p>
<p>End With</p>
<p align="left">End Sub<br />
_______________________________</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/47/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/47/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=47&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/26/get-values-by-looping-through-an-array-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>
	</item>
		<item>
		<title>Compile data from several workbooks</title>
		<link>http://sculpt.wordpress.com/2007/01/23/compile-data-from-several-workbooks/</link>
		<comments>http://sculpt.wordpress.com/2007/01/23/compile-data-from-several-workbooks/#comments</comments>
		<pubDate>Tue, 23 Jan 2007 22:08:00 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[files]]></category>
		<category><![CDATA[folder dialog]]></category>
		<category><![CDATA[merge data]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[workbooks]]></category>
		<category><![CDATA[worksheet]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/23/compile-data-from-several-workbooks/</guid>
		<description><![CDATA[This code shows you how to compile data from several similarly-structured workbooks into one worksheet. It utilises much of the code from the previous two posts, Check a worksheet exists in a specifed workbook and List files in a specified folder. First off, place all workbooks that need compiling into a distinct folder. In this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=46&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This code shows you how to compile data from several similarly-structured workbooks into one worksheet. It utilises much of the code from the previous two posts, <a href="http://sculpt.wordpress.com/2007/01/22/check-a-worksheet-exists-in-a-specified-workbook/">Check a worksheet exists in a specifed workbook</a> and <a href="http://sculpt.wordpress.com/2007/01/09/list-files-in-a-folder/">List files in a specified folder</a>.<span id="more-46"></span></p>
<p>First off, place all workbooks that need compiling into a distinct folder. In this example, I&#8217;ve placed them in:</p>
<p>C:\Documents and Settings\[username]\My Documents\Excel Application Development\MyWorkbooks\Workbooks\COMPILE\</p>
<p>The example gets all data from worksheet &#8220;Data&#8221; in the folder&#8217;s workbooks, compiling them as a list into this workbook. This code assumes the workbooks have exactly the same structure &#8211; therefore, values in column A are compiled to the new worksheet&#8217;s column A, column B to column B, etc&#8230;. We&#8217;ll use the Folder Dialog to find the location of the workbooks. Place this function in a blank module:<br />
____________________________</p>
<p>Public Function GetFolder() As Variant</p>
<p>Dim fd As FileDialog<br />
Set fd = Application.FileDialog(msoFileDialogFolderPicker)<br />
Dim vrtSelectedItem As Variant</p>
<p>With fd<br />
.Title = &#8220;Select folder&#8230;&#8221; &#8216;customise the dialog box title<br />
.InitialFileName = &#8220;C:\Documents and Settings\[username]\My Documents\Excel Application Development\My Workbooks\Workbooks\COMPILE\&#8221; &#8216;initial folder name to &#8216;display<br />
&#8216;The user pressed the action button.<br />
If .Show = -1 Then<br />
&#8216;Step through each string in the FileDialogSelectedItems collection.<br />
For Each vrtSelectedItem In .SelectedItems<br />
&#8216;The example declares the folder as a variant that&#8217;s used in the sub above.<br />
GetFolder = vrtSelectedItem<br />
Next vrtSelectedItem<br />
Else<br />
End If<br />
End With</p>
<p>Set fd = Nothing</p>
<p>End Function<br />
____________________________</p>
<p>When running through the workbooks, we&#8217;ll also want to make sure the worksheet &#8220;Data&#8221; exists in each workbook. To do this, use this function:<br />
____________________________</p>
<p>Public Function SheetExists(SheetName As String) As Boolean<br />
&#8216;Returns True if the sheet exists in the active workbook<br />
SheetExists = False<br />
On Error GoTo NoSuchSheet</p>
<p>If Len(Sheets(SheetName).Name) &gt; 0 Then<br />
SheetExists = True<br />
Exit Function<br />
End If</p>
<p>NoSuchSheet:</p>
<p>End Function</p>
<p>____________________________</p>
<p>The next thing we&#8217;ll need is some code that loops through all files in the specifed folder, checks that they are Excel workbooks, additionally checks they contain the worksheet &#8220;Data&#8221;, then if these conditions are met, compiles the data into our worksheet. To do this, we&#8217;ll amend the code we used <a href="http://sculpt.wordpress.com/2007/01/09/list-files-in-a-folder/">here</a> when listing files in a specifed folder. Ensure you enable the Microsoft ScriptingRuntime reference for this to work.</p>
<p>____________________________</p>
<p>Sub ListFilesInFolder(SourceFolderName As String)</p>
<p>Dim FSO As Scripting.FileSystemObject<br />
Dim SourceFolder As Scripting.Folder, SubFolder As Scripting.Folder<br />
Dim FileItem As Scripting.File<br />
Dim i As Integer<br />
Dim x As Integer</p>
<p>On Error GoTo ErrHandler &#8216;If the SourceFolderName from GetFolder is empty</p>
<p>Set FSO = New Scripting.FileSystemObject<br />
Set SourceFolder = FSO.GetFolder(SourceFolderName)<br />
i = 2 &#8216;Start row to compile data in ThisWorkbook</p>
<p>For Each FileItem In SourceFolder.Files &#8216;Loops through files in GetFolder<br />
If FileItem.Type = &#8220;Microsoft Excel Worksheet&#8221; Then &#8216;Ignores non-excel files<br />
myFile = FileItem.Name<br />
Workbooks.Open (myFile)</p>
<p>If SheetExists(&#8220;Data&#8221;) = True Then &#8216;Check if worksheet contains &#8220;Data&#8221; worksheet<br />
&#8216;Compile the data from here<br />
x = 2 &#8216;Start row of each opened workbook<br />
Do Until Workbooks(myFile).Worksheets(&#8220;Data&#8221;).Cells(x, 1).Value = &#8220;&#8221;<br />
&#8216;Change this code as required for your worksheet structure<br />
Workbooks(ThisWorkbook.Name).Worksheets(&#8220;Data&#8221;).Cells(i, 1).Value = _<br />
Workbooks(myFile).Worksheets(&#8220;Data&#8221;).Cells(x, 1).Value<br />
Workbooks(ThisWorkbook.Name).Worksheets(&#8220;Data&#8221;).Cells(i, 2).Value = _<br />
Workbooks(myFile).Worksheets(&#8220;Data&#8221;).Cells(x, 2).Value<br />
Workbooks(ThisWorkbook.Name).Worksheets(&#8220;Data&#8221;).Cells(i, 3).Value = _<br />
Workbooks(myFile).Worksheets(&#8220;Data&#8221;).Cells(x, 3).Value<br />
Workbooks(ThisWorkbook.Name).Worksheets(&#8220;Data&#8221;).Cells(i, 4).Value = _<br />
Workbooks(myFile).Worksheets(&#8220;Data&#8221;).Cells(x, 4).Value<br />
x = x + 1<br />
i = i + 1<br />
Loop<br />
Else<br />
End If<br />
Workbooks(myFile).Close False<br />
End If<br />
Next FileItem &#8216;Loops through next file</p>
<p>Set FileItem = Nothing<br />
Set SourceFolder = Nothing<br />
Set FSO = Nothing</p>
<p>ErrHandler:<br />
&#8216;If SourceFolderName from GetFolder is empty<br />
Set FileItem = Nothing<br />
Set SourceFolder = Nothing<br />
Set FSO = Nothing<br />
Exit Sub</p>
<p>End Sub<br />
____________________________</p>
<p>The final bit of code calls ListFilesInFolder(SourceFolderName As String):<br />
____________________________</p>
<p>Sub TestListFilesInFolder()</p>
<p>ListFilesInFolder GetFolder</p>
<p>End Sub<br />
____________________________</p>
<p>To run this, just change the worksheet name and amend the required columns. Run the process from TestListFilesInFolder, selecting the folder from the Folder Dialog box.</p>
<p>____________________________</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/46/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/46/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=46&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/23/compile-data-from-several-workbooks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>
	</item>
		<item>
		<title>Check a worksheet exists in a specified workbook</title>
		<link>http://sculpt.wordpress.com/2007/01/22/check-a-worksheet-exists-in-a-specified-workbook/</link>
		<comments>http://sculpt.wordpress.com/2007/01/22/check-a-worksheet-exists-in-a-specified-workbook/#comments</comments>
		<pubDate>Mon, 22 Jan 2007 21:16:48 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[file dialog]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[worksheet]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/22/check-a-worksheet-exists-in-a-specified-workbook/</guid>
		<description><![CDATA[When opening a specified workbook, you may need to check that it contains a particular worksheet. First open the workbook &#8211; to do this, we&#8217;ll use the File Dialog picker. The code below opens the File Dialog, then opens the selected workbook. ___________________________________ Sub OpenFile() Dim OpenFileName As Variant OpenFileName = Application.GetOpenFilename() &#8216;Opens the File [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=45&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When opening a specified workbook, you may need to check that it contains a particular worksheet. First open the workbook &#8211; to do this, we&#8217;ll use the File Dialog picker. The code below opens the File Dialog, then opens the selected workbook.<span id="more-45"></span></p>
<p>___________________________________</p>
<p>Sub OpenFile()</p>
<p>Dim OpenFileName As Variant</p>
<p>OpenFileName = Application.GetOpenFilename() &#8216;Opens the File Dialog<br />
If OpenFileName = False Then Exit Sub &#8216;If no file selected<br />
Workbooks.Open (OpenFileName)<br />
Call WorksheetCheck(OpenFileName) &#8216;Check if worksheet exists<br />
ActiveWorkbook.Close False</p>
<p>End Sub</p>
<p>___________________________________</p>
<p>The sub WorksheetCheck(OpenFileName) checks to see if the specified worksheet &#8211; &#8220;Data&#8221; &#8211; exists in the selected workbook. For this we need a new sub and a function &#8211; specify the name of the worksheet you&#8217;re checking for in the new sub. The function simply returns a True/ False to the sub, then displays a message box.</p>
<p>___________________________________</p>
<p>Sub WorksheetCheck(OpenFileName)</p>
<p>If SheetExists(&#8220;Data&#8221;) = True Then<br />
MsgBox (&#8220;The worksheet exists&#8221;)<br />
Else<br />
MsgBox (&#8220;The worksheet doesn&#8217;t exist&#8221;)<br />
End If</p>
<p>End Sub<br />
___________________________________</p>
<p>Function SheetExists(SheetName As String) As Boolean<br />
&#8216; True if worksheet exists in selected workbook<br />
SheetExists = False<br />
On Error GoTo NoSuchSheet</p>
<p>If Len(Sheets(SheetName).Name) &gt; 0 Then<br />
SheetExists = True<br />
Exit Function<br />
End If</p>
<p>NoSuchSheet:</p>
<p>End Function</p>
<p>___________________________________</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/45/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/45/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=45&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/22/check-a-worksheet-exists-in-a-specified-workbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>
	</item>
		<item>
		<title>List files in a specified folder</title>
		<link>http://sculpt.wordpress.com/2007/01/09/list-files-in-a-folder/</link>
		<comments>http://sculpt.wordpress.com/2007/01/09/list-files-in-a-folder/#comments</comments>
		<pubDate>Tue, 09 Jan 2007 23:54:44 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[files]]></category>
		<category><![CDATA[folder dialog]]></category>
		<category><![CDATA[folders]]></category>
		<category><![CDATA[passing arguments]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/09/list-files-in-a-folder/</guid>
		<description><![CDATA[There are numerous ways of listing files located in a specific folder. Below shows one of the easier ways of doing this. First off, we&#8217;ll want the main code to find the files. The code below works for the main folder picked &#8211; change the code as indicated if you wish to search within sub-folders. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=42&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are numerous ways of listing files located in a specific folder. Below shows one of the easier ways of doing this.<span id="more-42"></span></p>
<p>First off, we&#8217;ll want the main code to find the files. The code below works for the main folder picked &#8211; change the code as indicated if you wish to search within sub-folders.</p>
<p>To get this code to work, you need to make sure you have the Microsoft Scripting Runtime reference &#8211; select this from Tools &gt; References &gt; Microsoft Scripting Runtime.</p>
<p>___________________________________</p>
<p>Sub ListFilesInFolder(SourceFolderName As String) &#8216;For sub-folders, use<br />
&#8216;(SourceFolderName As String, IncludeSubfolders As Boolean)</p>
<p>Dim FSO As Scripting.FileSystemObject<br />
Dim SourceFolder As Scripting.Folder, SubFolder As Scripting.Folder<br />
Dim FileItem As Scripting.File</p>
<p>On Error GoTo ErrHandler &#8216;If the SourceFolderName from GetFolder is empty</p>
<p>Set FSO = New Scripting.FileSystemObject<br />
Set SourceFolder = FSO.GetFolder(SourceFolderName)</p>
<p>For Each FileItem In SourceFolder.FileS<br />
&#8216;Get the file names &#8211; declare as myFile<br />
myFile = FileItem.Name</p>
<p>&#8216;**********************************************<br />
&#8216;Pass the filenames to another sub &#8211; you can then use the filenames for some &#8216;purpose, either opening, copying, merging. This example just shows the file &#8216;name in a message box.<br />
&#8216;**********************************************<br />
Call NewTest(myFile)<br />
Next FileItem &#8216;Loops through all files in SourceFolder.FileS</p>
<p>&#8216;Add code below if using sub-folders</p>
<p>&#8216;If IncludeSubfolders Then<br />
&#8216;For Each SubFolder In SourceFolder.SubFolders<br />
&#8216;ListFilesInFolder &#8216;SubFolder.Path, True<br />
&#8216;Next SubFolder<br />
&#8216;End If</p>
<p>Set FileItem = Nothing<br />
Set SourceFolder = Nothing<br />
Set FSO = Nothing</p>
<p>ErrHandler:<br />
&#8216;If SourceFolderName from GetFolder is empty<br />
Set FileItem = Nothing<br />
Set SourceFolder = Nothing<br />
Set FSO = Nothing<br />
Exit Sub</p>
<p>End Sub<br />
___________________________________</p>
<p>Rather than hardcode the folder name, we can ask users to select it using the File dialog box. Use this code to open a customised file dialog box &#8211; in this example, we&#8217;ve set the default folder to C:\ and the title to &#8220;Select folder&#8230;&#8221;.<br />
___________________________________</p>
<p>Public Function GetFolder() As Variant</p>
<p>Dim Fd As FileDialog<br />
Set Fd = Application.FileDialog(msoFileDialogFolderPicker)<br />
Dim vrtSelectedItem As Variant</p>
<p>With Fd</p>
<p>.Title = &#8220;Select folder&#8230;&#8221; &#8216;customise the dialog box title<br />
.InitialFileName = &#8220;C:\&#8221; &#8216;initial folder name to display<br />
&#8216;The user pressed the action button.<br />
If .Show = -1 Then</p>
<p>For Each vrtSelectedItem In .SelectedItems<br />
GetFolder = vrtSelectedItem<br />
Next vrtSelectedItem<br />
Else<br />
End If<br />
End With</p>
<p>Set Fd = Nothing</p>
<p>End Function<br />
___________________________________</p>
<p>The next step is to create a small sub to call Sub ListFilesInFolder. All you need here is this:</p>
<p>___________________________________</p>
<p>Sub TestListFilesInFolder()</p>
<p>ListFilesInFolder GetFolder</p>
<p>&#8216;Use: ListFilesInFolder GetFolder, True to include sub-folders</p>
<p>End Sub<br />
___________________________________</p>
<p>The final step is to get our filenames into another sub, where we&#8217;ll do something with the filename. Here you can do exactly what you need, whether opening the file, renaming, listing the files in a workbook, getting the file properties.</p>
<p>This code simply gets the filename and displays it in a message box:<br />
___________________________________</p>
<p>Sub NewTest(myFile)</p>
<p>MsgBox (myFile)</p>
<p>End Sub</p>
<p>___________________________________</p>
<p>Now run Sub TestListFilesInFolder(). All files in the specified folder will be displayed in a message box.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/42/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/42/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=42&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/09/list-files-in-a-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>
	</item>
		<item>
		<title>Create a Function Library Add-In</title>
		<link>http://sculpt.wordpress.com/2007/01/08/create-a-function-library-add-in/</link>
		<comments>http://sculpt.wordpress.com/2007/01/08/create-a-function-library-add-in/#comments</comments>
		<pubDate>Mon, 08 Jan 2007 23:16:55 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[add-ins]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[if(iserror)]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/08/create-a-function-library-add-in/</guid>
		<description><![CDATA[A Function Library Add-In can be a convenient way of distributing your custom functions thoughout your organisation. The Add-In can then be installed, through the Tools &#62; Add-Ins Excel menu, by the user when required. However, you may want to think about whether an Add-In is the best way of performing the task. If a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=41&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A Function Library Add-In can be a convenient way of distributing your custom functions thoughout your organisation. The Add-In can then be installed, through the Tools &gt; Add-Ins Excel menu, by the user when required.<span id="more-41"></span></p>
<p>However, you may want to think about whether an Add-In is the best way of performing the task. If a workbook that utilises the Add-In is forwarded to a third-party, they will not be able to utilise the Add-In. While cell values based on the Add-In will not be altered, any attempt to recalculate the cell where the custom function is located will result in an error. To correct this, you would have to forward the workbook and the Add-In!</p>
<p>If you&#8217;re the only person likely to use the workbook, this obviously doesn&#8217;t present much of a problem. Equally, if you&#8217;re confident the Add-In is available to all other users of the workbook, there isn&#8217;t an issue. Therefore, only go ahead if one of these conditions have been met.</p>
<p>To create your Function Library Add-In, first create a new blank workbook, then insert a blank module. Paste the code from your <a href="http://sculpt.wordpress.com/2007/01/04/create-a-custom-function/">custom function</a> into the module &#8211; then run the Sub to create the description and category. To create a user-friendy title and description accesible from the Function Library dialog box, enter the details in the File Properties Title (Add-In title) and Comments (Add-In description) boxes. Then save the workbook as a .xla file in your Add-Ins folder &#8211; this is probably somewhere like:</p>
<p>\Documents and Settings\UserName\Application Data\Microsoft\AddIns</p>
<p>Then close the workbook.</p>
<p>Restart Excel. Select Tools &gt; Add-Ins. Your new custom function will be available to install:</p>
<p><a href="http://sculpt.files.wordpress.com/2007/01/functionlibraryaddin.JPG" title="functionlibraryaddin.JPG"><img src="http://sculpt.files.wordpress.com/2007/01/functionlibraryaddin.JPG?w=700" alt="functionlibraryaddin.JPG" /></a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/41/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/41/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=41&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/08/create-a-function-library-add-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>

		<media:content url="http://sculpt.files.wordpress.com/2007/01/functionlibraryaddin.JPG" medium="image">
			<media:title type="html">functionlibraryaddin.JPG</media:title>
		</media:content>
	</item>
		<item>
		<title>Create a dynamic named range using OFFSET</title>
		<link>http://sculpt.wordpress.com/2007/01/04/create-a-dynamic-named-range-using-offset/</link>
		<comments>http://sculpt.wordpress.com/2007/01/04/create-a-dynamic-named-range-using-offset/#comments</comments>
		<pubDate>Thu, 04 Jan 2007 14:37:26 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[dynamic ranges]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[named ranges]]></category>
		<category><![CDATA[offset]]></category>
		<category><![CDATA[ranges]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/04/create-a-dynamic-named-range-using-offset/</guid>
		<description><![CDATA[Named Ranges are a powerful tool in Excel &#8211; ranges can be used to shorten commonly-used functions and are more user friendly. Yet named ranges refer to absolute cell references. When you&#8217;re using a dynamic record list, you&#8217;ll need to ensure the named range is also dynamic. An easy way of doing this is creating [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=37&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Named Ranges are a powerful tool in Excel &#8211; ranges can be used to shorten commonly-used functions and are more user friendly. Yet named ranges refer to absolute cell references. When you&#8217;re using a dynamic record list, you&#8217;ll need to ensure the named range is also dynamic.<span id="more-37"></span></p>
<p>An easy way of doing this is creating a function, combining OFFSET and COUNTA. Using the OFFSET funtion the required arguments are:</p>
<p>Cell reference: the base point for OFFSET. Let&#8217;s define this as Rng!$A$1.</p>
<p>Rows: we want the upper-left row to be the same as the base point cell &#8211; therefore, enter 0.</p>
<p>Columns: we want the upper-left column to be the same as the base point cell &#8211; therefore, enter 0.</p>
<p>Height: in a dynamic range, the height of the range is the variable. We can get the height from the COUNTA function, returning a value for non-blank cells. In this example, the height will equal COUNTA(Rng!$A:$A).</p>
<p>Width: this is the width, in columns, that the reference will refer to. In this example, we&#8217;ll set this to 1.</p>
<p>We end up with this function:</p>
<p>=OFFSET(Rng!$A$1,0,0,COUNTA(Rng!$A:$A),1)</p>
<p>The named range can be defined manually through Insert &gt; Name &gt; Define &gt; Refers To, where Refers To is our OFFSET function:</p>
<p><a href="http://sculpt.files.wordpress.com/2007/01/definename.JPG" title="definename.JPG"><img src="http://sculpt.files.wordpress.com/2007/01/definename.JPG?w=700" alt="definename.JPG" /></a></p>
<p>Alternatively you can define the named range through vba &#8211; you should define the named range when opening the workbook. To define the name using vba, use this code:</p>
<p>______________________________________</p>
<p>ThisWorkbook.Names.Add Name:=&#8221;NewDynamicRange&#8221;, RefersTo:= _<br />
&#8220;=OFFSET(Rng!$A$1,0,0,COUNTA(Rng!$A:$A),1)&#8221;, Visible:=True<br />
______________________________________</p>
<p>If you&#8217;re using the dynamic named range within a VLOOKUP function, change the width in the OFFSET function to the number of columns in the range &#8211; for a two column range, the function would read:</p>
<p>=OFFSET(Rng!$A$1,0,0,COUNTA(Rng!$A:$A),2)</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=37&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/04/create-a-dynamic-named-range-using-offset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>

		<media:content url="http://sculpt.files.wordpress.com/2007/01/definename.JPG" medium="image">
			<media:title type="html">definename.JPG</media:title>
		</media:content>
	</item>
		<item>
		<title>Create a custom function</title>
		<link>http://sculpt.wordpress.com/2007/01/04/create-a-custom-function/</link>
		<comments>http://sculpt.wordpress.com/2007/01/04/create-a-custom-function/#comments</comments>
		<pubDate>Thu, 04 Jan 2007 13:10:44 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[functions]]></category>
		<category><![CDATA[if(iserror)]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/04/create-a-custom-function/</guid>
		<description><![CDATA[When you frequently use a non-standard function, it may be an idea to create a custom function at workbook start-up using a User-defined function (UDF). The IF(ISERROR) function is one example of this. We can create a custom IF(ISERROR) function in two easy steps: 1. Implement the custom function: ___________________________________ Public Function IFISERROR(ByRef Evaluate As [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=35&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When you frequently use a non-standard function, it may be an idea to create a custom function at workbook start-up using a User-defined function (UDF). The IF(ISERROR) function is one example of this.<span id="more-35"></span></p>
<p>We can create a custom IF(ISERROR) function in two easy steps:</p>
<p>1. Implement the custom function:<br />
___________________________________<br />
Public Function IFISERROR(ByRef Evaluate As Variant, _<br />
ByRef Default As Variant) As Variant<br />
If IsError(Evaluate) Then<br />
IFISERROR = Default &#8216;if an error, returns default<br />
Else<br />
IFISERROR = Evaluate &#8216;no error, evaluates function<br />
End If</p>
<p>End Function<br />
___________________________________</p>
<p>The function is now available to use &#8211; this is accessible from the User Defined category in Insert Function. However, this offers no guide how the function works. You can add this information be registering the UDF in step 2.</p>
<p>2. Register the custom UDF:<br />
___________________________________<br />
Sub CreateCustomFunction()</p>
<p>Dim strDescription As String<br />
strDescription = &#8220;A custom IF(ISERROR) function: &#8221; &amp; _<br />
vbLf &amp; &#8220;=IF(ISERROR(function),default value,function)&#8221;<br />
&#8216;this text will appear in the function dialog box<br />
Application.MacroOptions Macro:=&#8221;IFISERROR&#8221;, _<br />
Description:=strDescription, _<br />
Category:=9 &#8217;9=Information category of UDF category names</p>
<p>End Sub<br />
___________________________________</p>
<p>Run the CreateCustomFunction (you can run this from the Workbook_Open event) and your new custom function will appear in the function dialog box:</p>
<p><a href="http://sculpt.files.wordpress.com/2007/01/customfunction.JPG" title="customfunction.JPG"><img src="http://sculpt.files.wordpress.com/2007/01/customfunction.JPG?w=700" alt="customfunction.JPG" /></a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=35&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/04/create-a-custom-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>

		<media:content url="http://sculpt.files.wordpress.com/2007/01/customfunction.JPG" medium="image">
			<media:title type="html">customfunction.JPG</media:title>
		</media:content>
	</item>
		<item>
		<title>Add a custom icon to a custom command bar</title>
		<link>http://sculpt.wordpress.com/2007/01/03/add-a-custom-icon-to-a-custom-command-bar/</link>
		<comments>http://sculpt.wordpress.com/2007/01/03/add-a-custom-icon-to-a-custom-command-bar/#comments</comments>
		<pubDate>Wed, 03 Jan 2007 22:56:03 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[command bars]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[vba]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/03/add-a-custom-icon-to-a-custom-command-bar/</guid>
		<description><![CDATA[You can add an icon directly to your custom command bar directly through Excel with no need for Add-Ins. First you&#8217;ll need to create your icon. You can do this using Paint. Make sure you save your icon as a 16 x 16 pixel 16-colour bmp &#8211; when designing it, zoom at 800% for greater [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=31&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You can add an icon directly to your custom command bar directly through Excel with no need for Add-Ins.<span id="more-31"></span></p>
<p>First you&#8217;ll need to create your icon. You can do this using Paint. Make sure you save your icon as a 16 x 16 pixel 16-colour bmp &#8211; when designing it, zoom at 800% for greater clarity. Once created, save to the same path as your workbook.</p>
<p><a href="http://sculpt.files.wordpress.com/2007/01/creaticon.JPG" title="creaticon.JPG"><img src="http://sculpt.files.wordpress.com/2007/01/creaticon.JPG?w=700" alt="creaticon.JPG" /></a></p>
<p>You&#8217;ll also need to create a mask for the custom icon &#8211; do this by selecting Black &amp; White from the Attributes in the Image options. The mask should be called something like IconMask.bmp.</p>
<p>Now you&#8217;re ready to run your code. This example is based on the previous custom command bar &#8211; the difference is that an additional control button is added to show the new icon. The code gets the icon and the icon mask from the same file path as your workbook &#8211; if your icons aren&#8217;t stored here, just change the code accordingly.</p>
<p>__________________________</p>
<p>Public Sub AddCustomIcon()</p>
<p>Dim cbar As Object<br />
Dim Cmb As Object<br />
Dim SubMenu As Object<br />
Dim NewCb As Object<br />
Dim SubMenu1 As Object<br />
Dim SubMenu2 As Object<br />
Dim SubMenu3 As Object<br />
Dim SubMenu4 As Object<br />
Dim strPath As String<br />
On Error Resume NextSet cbar = CommandBars.Add(Name:=&#8221;Sculpt&#8221;, Position:=msoBarTop,</p>
<p>Temporary:=True)<br />
cbar.Visible = True<br />
cbar.Enabled = True</p>
<p>Dim NewMenu As Object<br />
Set NewMenu = CommandBars(&#8220;Sculpt&#8221;)<br />
With NewMenu<br />
.Visible = True<br />
.Enabled = True<br />
.Controls.Add(Type:=msoControlButton, before:=1).Caption = &#8220;SculptIcon&#8221;<br />
.Controls.Add(Type:=msoControlPopup, before:=2).Caption = &#8220;Sculpt&#8221;<br />
.Controls.Add(Type:=msoControlDropdown, before:=3).Caption = _                &#8220;Select period&#8221;<br />
.Controls.Add(Type:=msoControlButton, before:=4).Caption = &#8220;Get data&#8221;<br />
End With</p>
<p>&#8216;Add the custom icon<br />
strPath = ThisWorkbook.Path &#8216;filepath of your workbook<br />
If Right(strPath, 1) &lt;&gt; &#8220;\&#8221; Then strPath = strPath &amp; &#8220;\&#8221;<br />
Set SubMenu = CommandBars(&#8220;Sculpt&#8221;).Controls(&#8220;SculptIcon&#8221;)<br />
With SubMenu<br />
.Picture = LoadPicture(strPath &amp; &#8220;Sculpt.bmp&#8221;)<br />
.Mask = LoadPicture(strPath &amp; &#8220;SculptMask.bmp&#8221;)<br />
End With</p>
<p>&#8216;Add the custom submenus<br />
Set SubMenu1 = CommandBars(&#8220;Sculpt&#8221;).Controls(&#8220;Sculpt&#8221;)<br />
With SubMenu1<br />
.Controls.Add(Type:=msoControlPopup, before:=1).Caption = &#8220;Print&#8221;<br />
.Controls.Add(Type:=msoControlButton, before:=2).Caption = &#8220;Get Budgets&#8221;<br />
End With</p>
<p>&#8216;Add the dropdown list items<br />
Set Cmb = CommandBars(&#8220;Sculpt&#8221;).Controls(&#8220;Select period&#8221;)<br />
With Cmb<br />
.Width = 120<br />
.Caption = &#8220;Select Month&#8221;<br />
.Visible = True<br />
.Enabled = True<br />
.AddItem &#8220;November 2006&#8243;, 1<br />
.AddItem &#8220;December 2006&#8243;, 2<br />
.AddItem &#8220;January 2007&#8243;, 3<br />
.AddItem &#8220;February 2007&#8243;, 4<br />
.AddItem &#8220;March 2007&#8243;, 5<br />
.ListIndex = 1<br />
&#8216;.OnAction = &#8220;&#8216;&#8221; &amp; ActiveWorkbook.Name &amp; &#8220;&#8216;!ShowValue&#8221;<br />
End With</p>
<p>Set NewCb = CommandBars(&#8220;Sculpt&#8221;).Controls(&#8220;Get Data&#8221;)<br />
With NewCb<br />
.Caption = &#8220;Get data&#8221;<br />
.Visible = True<br />
.FaceId = 7433<br />
End With</p>
<p>&#8216;Now add sub-menu items<br />
Set SubMenu2 = CommandBars(&#8220;Sculpt&#8221;).Controls(&#8220;Sculpt&#8221;).Controls(&#8220;Print&#8221;)<br />
With SubMenu2<br />
.Controls.Add(Type:=msoControlButton, before:=1).Caption = _             &#8220;All Records&#8221;<br />
.Controls(&#8220;All Records&#8221;).FaceId = 109<br />
.Controls.Add(Type:=msoControlButton, before:=2).Caption = _      &#8220;Active Records&#8221;<br />
.Controls(&#8220;Active Records&#8221;).FaceId = 928<br />
End With</p>
<p>Set SubMenu3 = CommandBars(&#8220;Sculpt&#8221;).Controls(&#8220;Get data&#8221;)<br />
With SubMenu3<br />
.OnAction = &#8220;&#8216;&#8221; &amp; ActiveWorkbook.Name &amp; &#8220;&#8216;!SubName&#8221;<br />
End With</p>
<p>Set SubMenu4 = CommandBars(&#8220;Sculpt&#8221;).Controls(&#8220;Sculpt&#8221;).Controls(&#8220;Get Budgets&#8221;)<br />
With SubMenu4<br />
.OnAction = &#8220;&#8216;&#8221; &amp; ActiveWorkbook.Name &amp; &#8220;&#8216;!SubName&#8221;<br />
End With</p>
<p>&#8216;Begin groups<br />
Application.CommandBars(&#8220;Sculpt&#8221;).Controls(&#8220;Sculpt&#8221;) _<br />
.Controls(&#8220;Get budgets&#8221;).BeginGroup = True</p>
<p>Set NewMenu = CommandBars(&#8220;Sculpt&#8221;)<br />
With NewMenu<br />
.Protection = msoBarNoChangeVisible<br />
End With</p>
<p>End Sub<br />
__________________________</p>
<p>Your new custom command bar will look like this:</p>
<p><a href="http://sculpt.files.wordpress.com/2007/01/customicon.JPG" title="customicon.JPG"><img src="http://sculpt.files.wordpress.com/2007/01/customicon.JPG?w=700" alt="customicon.JPG" /></a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=31&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/03/add-a-custom-icon-to-a-custom-command-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>

		<media:content url="http://sculpt.files.wordpress.com/2007/01/creaticon.JPG" medium="image">
			<media:title type="html">creaticon.JPG</media:title>
		</media:content>

		<media:content url="http://sculpt.files.wordpress.com/2007/01/customicon.JPG" medium="image">
			<media:title type="html">customicon.JPG</media:title>
		</media:content>
	</item>
		<item>
		<title>countif</title>
		<link>http://sculpt.wordpress.com/2007/01/03/countif/</link>
		<comments>http://sculpt.wordpress.com/2007/01/03/countif/#comments</comments>
		<pubDate>Wed, 03 Jan 2007 19:23:10 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[arrays]]></category>
		<category><![CDATA[count if]]></category>
		<category><![CDATA[functions]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/03/countif/</guid>
		<description><![CDATA[As with the basic SUMIF function, you might want to perform COUNTIF using multiple criteria? Use this array formula &#8211; you can use named ranges, as in the example. However, the named range must refer to the same rows: i.e. you could use named ranges referring to A2:A1000 and B2:B1000, but A2:A500 and B2:B2000 would [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=30&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As with the basic <a href="http://sculpt.wordpress.com/2006/12/29/sumif/">SUMIF</a> function, you might want to perform COUNTIF using multiple criteria?<span id="more-30"></span></p>
<p>Use this array formula &#8211; you can use named ranges, as in the example. However, the named range must refer to the same rows: i.e. you could use named ranges referring to A2:A1000 and B2:B1000, but A2:A500 and B2:B2000 would not work.</p>
<p>{=SUM((CData=$A$9)*(BData=$B$9))}</p>
<p>This counts the number of records where the named range CData = $A$9 AND BData = $B$9.</p>
<p>You must press CTRL + SHIFT + ENTER for the array formula to function.</p>
<p>The above example functions as an AND statement. You can modify this to an OR by replacing * with +, counting the number of records where CData = $A$9 OR BData = $B$9:</p>
<p>{=SUM((CData=$A$9)+(BData=$B$9))}</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=30&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/03/countif/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>
	</item>
		<item>
		<title>Customise the right-click Cell command bar</title>
		<link>http://sculpt.wordpress.com/2007/01/02/customise-the-right-click-cell-command-bar/</link>
		<comments>http://sculpt.wordpress.com/2007/01/02/customise-the-right-click-cell-command-bar/#comments</comments>
		<pubDate>Tue, 02 Jan 2007 23:31:56 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[command bars]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[right-click]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[worksheet events]]></category>

		<guid isPermaLink="false">http://sculpt.wordpress.com/2007/01/02/customise-the-right-click-cell-command-bar/</guid>
		<description><![CDATA[You might need to disable some functionality in the standard right-click cell command bar to halt users performing functions that could threaten the integrity of your workbook. You may also want to add some functionality not available in the standard cell command bar. This code removes all controls except Insert Comments &#8211; this is done [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=28&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You might need to disable some functionality in the standard right-click cell command bar to halt users performing functions that could threaten the integrity of your workbook. You may also want to add some functionality not available in the standard cell command bar.<span id="more-28"></span></p>
<p>This code removes all controls except Insert Comments &#8211; this is done by looping through all controls available in the Cells command bar, deleting all except Insert Comments. We then add two additional controls: one named Sculpt and a further dropdown similar to that in our <a href="http://sculpt.wordpress.com/2006/12/30/add-a-custom-command-bar/" title="Add a custom command bar">customised command bar</a>. The code is run from the Worksheet_BeforeRightClick event.</p>
<p>_____________________</p>
<p>Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _<br />
Cancel As Boolean)</p>
<p>Dim icbc As Object<br />
Dim myBar As Object<br />
Dim Cmb As Object<br />
On Error Resume Next</p>
<p>CommandBars(&#8220;Cell&#8221;).Reset<br />
CommandBars(&#8220;Cell&#8221;).Enabled = True</p>
<p>For Each icbc In Application.CommandBars(&#8220;Cell&#8221;).Controls<br />
If icbc.ID = 21 Or icbc.ID = 19 Or icbc.ID = 22 Or icbc.ID = 755 Or icbc.ID = 3181 Or icbc.ID = 292 _<br />
Or icbc.ID = 3125 Or icbc.ID = 855 Or icbc.ID = 1966 Or icbc.ID = 1576 Or icbc.ID = 30094 _<br />
Or icbc.ID = 7193 Or icbc.ID = 5685 Or icbc.ID = 577 Or icbc.ID = 7685 Then icbc.Delete<br />
Next icbc</p>
<p>With Application.CommandBars(&#8220;Cell&#8221;)<br />
.Controls.Add(Type:=msoControlButton, before:=2).Caption = &#8220;Sculpt&#8221;<br />
.Controls.Add(Type:=msoControlDropdown, before:=3).Caption = _</p>
<p>&#8220;Find month&#8221;<br />
End With</p>
<p>Set Cmb = CommandBars(&#8220;Cell&#8221;).Controls(&#8220;Find month&#8221;)<br />
With Cmb<br />
.Width = 200<br />
.Visible = True<br />
.Enabled = True<br />
.AddItem &#8220;November 2006&#8243;, 1<br />
.AddItem &#8220;December 2006&#8243;, 2<br />
.AddItem &#8220;January 2007&#8243;, 3<br />
.AddItem &#8220;February 2007&#8243;, 4<br />
.AddItem &#8220;March 2007&#8243;, 5<br />
.ListIndex = 1<br />
&#8216;.OnAction = “‘” &amp; ThisWorkbook &amp; “‘!SubName”<br />
End With<br />
End Sub</p>
<p>_____________________</p>
<p>The customised Cell command bar will appear like this:</p>
<p><a href="http://sculpt.files.wordpress.com/2007/01/rightclickcommandbar.JPG" title="rightclickcommandbar.JPG"><img src="http://sculpt.files.wordpress.com/2007/01/rightclickcommandbar.JPG?w=700" alt="rightclickcommandbar.JPG" /></a></p>
<p>Remember to reset the Cells command bar when you deactivate the worksheet and the workbook:</p>
<p>_____________________</p>
<p>Private Sub Worksheet_Deactivate()</p>
<p>CommandBars(&#8220;Cell&#8221;).Reset<br />
CommandBars(&#8220;Cell&#8221;).Enabled = True</p>
<p>End Sub</p>
<p>_____________________</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sculpt.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sculpt.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sculpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sculpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sculpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sculpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sculpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sculpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sculpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sculpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sculpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sculpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sculpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sculpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sculpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sculpt.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sculpt.wordpress.com&amp;blog=643791&amp;post=28&amp;subd=sculpt&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sculpt.wordpress.com/2007/01/02/customise-the-right-click-cell-command-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/df6bb70d2fcd17fc74d9ecd6dabae0bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Austin</media:title>
		</media:content>

		<media:content url="http://sculpt.files.wordpress.com/2007/01/rightclickcommandbar.JPG" medium="image">
			<media:title type="html">rightclickcommandbar.JPG</media:title>
		</media:content>
	</item>
	</channel>
</rss>
