MS-Excel / Excel 2003

Playing back the macro

To play back a macro you've recorded, press Alt+F8 or choose Tools → Macro → Macros to open the Macro dialog box. This dialog box lists all the macros in the current workbook as well as those in your Personal Macro Workbook (provided you've created one). Click the name of the macro that you want to play and then 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 you assigned, and Excel immediately plays back all the commands that you recorded.

You can assign the macros that you create to buttons or menu items on custom toolbars or menus that you create and then play them back by clicking the custom button or selecting the custom menu item to which the macro is assigned.

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 references in a macro, the macro recorder always inserts absolute references in the macro sheet unless you click the Relative Reference button on the Stop Recording toolbar 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 workbook active).

Excel automatically sets the level of macro security to the highest level - a level that prevents macros that aren't digitally signed from running. To enable Excel to run macros that aren't signed but that you know come from trustworthy sources (such as Fred in Accounting), reset the macro security level to Medium on the Security Level tab of the Security dialog box (Tools → Macro → Security). Excel thereafter prompts you to enable such macros in the worksheet.

[Previous] [Contents] [Next]