This Part is
a primer on Excel macros, covering everything you need to know about Excel
macros and VBA to get started with the 101 macros throughout the rest of this
book.
You need not
be a power user to create and use simple VBA macros. Even casual users can
simply turn on Excel's macro recorder.
Recording a
macro is like programming a phone number into your cell phone. You first
manually dial and save a number. Then when you want, you can redial those
numbers with the touch of a button. Just as with numbers on a cell phone, you
can record your actions in Excel while you perform them. While you record,
Excel gets busy in the background, translating your keystrokes and mouse clicks
to written VBA code. After you've recorded a macro, you can play back those
actions anytime you wish.
This Part
serves as an introduction to Excel Macros and VBA in general. Here, we give you
a concise summary of how VBA works with Excel, giving you the basic foundation
you need to work with the 101 macros listed in this book.
To start
recording your first macro, you need to first find the Macro Recorder, which is
on the Developer tab. Unfortunately, Excel comes out of the box with the
Developer tab hidden — you may not see it on your version of Excel at first. If
you plan to work with VBA macros, you'll want to make sure that the Developer
tab is visible. To display this tab
- Choose Office→Excel Options.
- In the Excel Options dialog box, select Customize Ribbon.
- In the list box on the right, place a check mark next to Developer.
- Click OK to return to Excel.
Now that you
have the Developer tab showing in the Excel Ribbon, you can start up the Macro
Recorder by selecting Record Macro from the Developer tab. This activates the
Record Macro dialog box, as shown in Figure 1.
Figure 1-1: The Record Macro dialog box
Here are the
four parts of the Record Macro dialog box: