Running the Macro


After you create a macro, you can use it to repeat its commands. Excel offers many ways to run a macro. Here are the two most common methods for running a macro:

  • Select Tools, Macro, Macros, Run.

  • Use the macro shortcut key (if you defined one).

The quickest way to run the macro is to use the macro shortcut key. If the macro doesn't have a shortcut key assigned to it, you must use Tools, Macro, Macros, Run.

In the following To Do exercise, you run the macro you just created by using the macro name , Font_change .

To Do: Run the Macro

  1. First select cell A1 in the Summary sheet. This data in this cell needs a font change.

  2. Choose Tools, Macro, Macros. The Macro dialog box appears, as shown in Figure 20.4.

    Figure 20.4. The Macro dialog box.

    graphics/20fig04.jpg

  3. In the Macro dialog box, select Font_change .

  4. Click Run. Excel runs the Font_change macro by changing the title in the worksheet to a 22-point Arial font.

If you want to run the macro using a shortcut key, just press the shortcut key you assigned to the macro. Before testing the Font_change macro, select cell J16. Then, to run the Font_change macro, press Ctrl+Shift+F. Excel should format the data in cell J16 with the 22-point Arial font. Macros are powerful, aren't they? You'll have to make column J wider to accommodate the long entry in cell J16.

graphics/lightbulb_icon.gif

You can stop a macro while it's running by simply pressing the Esc key. Excel stops the macro before it completes its actions.




Sams Teach Yourself Microsoft Office Excel 2003 in 24 Hours
Sams Teach Yourself Microsoft Office Excel 2003 in 24 Hours (Sams Teach Yourself in 24 Hours)
ISBN: 1435276337
EAN: 2147483647
Year: 2003
Pages: 279
Authors: Trudi Reisner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net