Datasheet
Book VIII
Chapter 1
Building and
Running Macros
Macro Basics
707
Running a macro
After recording a macro, you can run it by doing any of the following:
✦ Click the View Macros option on the Macros command button on the
View tab or press Alt+WMV.
✦ Click the Macros command button on the Developer tab of the Ribbon
when it’s displayed or press Alt+LPM.
✦ Press Alt+F8.
Excel then opens the Macro dialog box, which is similar to the one shown in
Figure 1-3. As this figure shows, Excel lists the names of all the macros in the
current workbook and in your Personal Macro Workbook (provided you’ve
created one) in the Macro Name list box. Click the name of the macro that
you want to play and click the Run button or press Enter.
If you assigned a shortcut keystroke to the macro, you don’t have to bother
opening the Macro dialog box to play the macro: Simply press Ctrl plus the
letter key or Ctrl+Shift plus the letter key that you assigned and Excel imme-
diately plays back all of the commands that you recorded.
Before testing a new macro, you may need to select a new worksheet, or at
least a new cell range within the active worksheet. When recording cell refer-
ences in a macro, the macro recorder always inserts absolute references in
the macro sheet unless you click the Use Relative References button on the
Developer tab before you start choosing the commands and taking the
actions in the spreadsheet that you want recorded as part of the macro. This
means that your macro enters its data entries or performs its formatting in
the same area of the active worksheet (unless the code in the macro itself
causes the macro to first select a new area or select a new sheet in the active
workbook).
Figure 1-3:
Selecting
the macro to
run in the
Macro
dialog box.
36_037385 bk08ch01.qxp 11/29/06 1:13 PM Page 707