Microsoft Excel 2002 Visual Basic for Applications Step by Step (Step by Step (Microsoft))
-
Use the Immediate window to test statements before you put them in your macro. The Immediate window is particularly useful to step through a macro that just contains variable declarations.
-
Make the most of recorded macros that assign values to object properties. You can easily convert those macros into ones that update the existing value of a property.
-
Look for additional arguments when the recorder uses a method. There may be interesting capabilities you didn’t know were available.
-
Watch for objects that are collections. They are very likely to have an Item property (to get one item), a Count property (to find out how many items are in the collection), and an Add method (to create a new item).
-
The Add method of most collections returns a reference to the item it creates. Store that item in a variable to make it easy to use later in the macro.