Archive for the ‘Worksheet Object’ Category.

Looping Through Sheets

There are a number of ways to loop through the sheets in the workbook. Here are three examples.
In the first example, I create an Object variable and use the For Each construct. As you know, Sheets can be Worksheets, Chart Sheets and Dialog Sheets. They can also be Macro sheets, but those [...]

Hiding the Cursor

When I do some screen shots, I need to hide the cursor. Not only do I want no cell selected, but I don't want the column or row headers highlighted - so I can't just page down for instance. Manually, I was using Ctrl+End to get to the last cell followed by a [...]

Formatting Footers in VBA

In the UI, you have some formatting options when entering a custom footer (File > Page Setup > Header/Footer). You also have those options when creating a footer in VBA, you just have to know the codes to use.
Special codes like page numbers and dates can be found in the constant definition section of [...]

Limiting a Range for Looping

The For Each construct can be used to loop through a range. By limiting the range, you can speed up your code. The Intersect function is a good way to limit the range. For instance, to convert everything in column A to proper case, you can use a sub like this:
Sub ConvertAToProper()
    Dim [...]