-
Set the security level to Medium or Low.
- On the Tools menu, click Options.
- Click the Security tab.
- Under Macro Security, click Macro Security.
- Click the Security Level tab, and then select the security level you want to use.
- Open the workbook that contains the macro.
- On the Tools menu, point to Macro, and then click Macros.
- In the Macro name box, enter the name of the macro you want to run.
- Do one of the following:
Run a macro in a Microsoft Excel workbook
- Click Run.
If you want to interrupt, press ESC.
Run a macro from a Microsoft Visual Basic module
- Click Edit.
- Click Run Sub/UserForm .
If you want to run a different macro while you are in the Visual Basic Editor, click Macros on the Tools menu. In the Macro name box, enter the name of the macro you want to run, and then click Run.
- Click Run.
Start a macro from a keyboard shortcut
- On the Tools menu, point to Macro, and then click Macros.
- In the Macro name box, enter the name of the macro you want to assign to a keyboard shortcut key.
- Click Options.
- If you want to run the macro by pressing a keyboard shortcut key, enter a letter in the Shortcut key box. You can use CTRL+ letter (for lowercase letters) or CTRL+SHIFT+ letter (for uppercase letters), where letter is any letter key on the keyboard. The shortcut key letter you use cannot be a number or special character such as @ or #.
Note The shortcut key will override any equivalent default Microsoft Excel shortcut keys while the workbook that contains the macro is open.
-
If you want to include a description of the macro, type it in the Description box.
- Click OK.
- Click Cancel.
Start a macro from a button or graphic control
- Click the button or graphic control so that sizing handles appear.
- With the graphic object selected, right-click a sizing handle of the button or graphic object to display the shortcut menu.
- On the shortcut menu, click Assign Macro.
- Do one of the following:
- To assign an existing macro to the button or graphic object, enter the name of the macro in the Macro name box, and then click OK.
-
To record a new macro to assign to the selected graphic object, click Record. When you finish recording the macro, click Stop Recording on the Stop Recording toolbar.
-
To write a new macro in the Visual Basic Editor, click New. To edit an existing macro, click the name of the macro in the Macro Name box, and then click Edit.
Note If you assign a macro to a button or other object that is already in use as a hyperlink, the hyperlink information is deleted. From then on, clicking the button or object runs the macro instead.
Start a macro from an area, or hotspot, on a graphic object
- Draw another object to create a hot spot for an existing object.
- With the second graphic object selected, right-click a sizing handle of the button or graphic object to display the shortcut menu.
- On the shortcut menu, click Assign Macro.
- Do one of the following:
- To assign an existing macro to the button or graphic object, enter the name of the macro in the Macro name box, and then click OK.
-
To record a new macro to assign to the selected graphic object, click Record. When you finish recording the macro, click Stop Recording on the Stop Recording toolbar.
-
To write a new macro in the Visual Basic Editor, click New. To edit an existing macro, click the name of the macro in the Macro Name box, and then click Edit.
- On the Format menu, click AutoShape, and then click the Color and Lines tab.
- Under Fill, click No Fill in the Color box. Under Line, click No Line in the Color box.
- Repeat these steps for each hotspot you want to create. You do not need to create a new graphic object for each hotspot.
Start a macro from a toolbar button
- On the Tools menu, click Customize.
- Do one of the following:
- If the toolbar that contains the button is not visible, click the Toolbars tab, and then select the check box next to the toolbar name.
- If the button you want to run the macro from is not on a toolbar, click the Commands tab, and then click Macros in the Categories list. In the Commands list, drag the Custom button onto a toolbar.
- Right-click the toolbar button, and then click Assign Macro on the shortcut menu.
- Enter the name of the macro in the Macro name box, and then click OK.