Microsoft Office Tutorials and References
In Depth Information
If you create a macro, you need a way to execute it. This tip describes all the ways to execute a
macro in Excel 2010.
Use the Macro dialog box
All available macros are listed in the Macro dialog box. For a macro to be available, the workbook
that contains the macro must be open. To display the Macro dialog box, choose View
Macros (or press Alt+F8). The Macro dialog box displays the macros in a list. Just select the
macro and click Run.
Use the Visual Basic Editor window
You can execute macros directly from the VBE — although it’s certainly not the most convenient
method. Press Alt+F11 to activate the VBE. Then locate the project and the code module that
contains the macro. Place the cursor anywhere within the macro code, and choose Run
Sub/UserForm (or press F5).
Use a shortcut key
When you begin recording a macro, the Record Macro dialog box gives you an opportunity to
provide a shortcut key for the macro. If you later want to change the shortcut key or provide a
shortcut key for a macro that doesn’t have one, follow these steps:
1. Press Alt+F8 to display the Macro dialog box.
2. In the Macro dialog box, select the macro name from the list.
3. Click the Options button. Excel displays the Macro Options dialog box.
4. Specify the shortcut key and click OK to return to the Macro dialog box.
5. Click Cancel to close the Macro dialog box.
Assign the macro to a button
You can add a button to a worksheet and then execute a macro by clicking the button.
To add a button to a worksheet, the Developer tab must be present. To display this
tab, choose File
Options. In the Excel Options dialog box, select the Customize
Ribbon tab, and place a checkmark next to Developer.