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, then you must use Tools, Macro, Macros, Run.

In the following steps, you run the macro you just created by using the macro name , Font_change.

  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 49.4.

    Figure 49.4. The Macro dialog box.

    graphics/49fig04.gif

  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. You'll have to make column A a little wider to accommodate the long entry in cell A1.

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?

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 Office Productivity All in One
Sams Teach Yourself Office Productivity All in One (Sams Teach Yourself All in One)
ISBN: 0672325349
EAN: 2147483647
Year: 2003
Pages: 474
Authors: Greg Perry

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