Microsoft Office Tutorials and References
In Depth Information
Using the Macro Recorder
About Collection Names
As you know, a collection is an object that contains similar objects. Normally, the
name of the collection consists of the plural form of the object. For example, the
Workbooks collection contains all open Workbook objects, and the ChartObjects
collection consists of all ChartObject objects on a worksheet. But what about the
collection of Series objects? Because the singular and plural form of the word Series
are identical, the designers deviated from this naming convention. Therefore, the
collection of all Series objects is known as a SeriesCollection object (not a
Series collection object).
Using the Macro Recorder
The macro recorder is a handy tool that converts your Excel actions into VBA code.
However, this tool is not the ultimate solution to creating macros. It’s important to
remember the following points:
The macro recorder is appropriate only for simple macros or for recording
a small part of a more complex macro. You’ll also find that examining
recorded code is an excellent way to learn about objects, properties, and
methods.
The macro recorder cannot generate code that performs looping (that is,
repeating statements), assigns variables, executes statements conditionally,
displays dialog boxes, and so on.
The code that is generated depends on certain settings that you specify.
You’ll usually want to clean up the recorded code to remove extraneous
commands.
Excel’s Visual Basic toolbar has several useful buttons for you. On this toolbar
you’ll find the Run Macro, Record Macro, Stop Macro, and Visual Basic Editor
buttons useful.
Hands-on: Recording a macro
This section introduces the macro recorder with a simple hands-on exercise. Start with
a new workbook, enter some data, and create a default column chart. Figure 15-3
shows the data and chart that I created.
Search JabSto ::




Custom Search