Related Tutorials
Assign a Macro to a Button
You can run a macro from a button on a Toolbar, a button on the sheet or any other graphic control.
Add a macro to a toolbar button
- Click Customize from the Tools menu
- Click the Commands tab
- Select Macros in the Categories list
- In the Commands list, drag the Custom button onto the toolbar. A black line appears indicating the position of the button on release of the mouse button
- Right click the toolbar button and click Assign Macro on the shortcut menu
- Select the macro from the list and click Ok
The button can now be seen on the toolbar and is just one click away whenever needed.
The edit or remove a toolbar button, the Customise dialogue box needs to be open. Click Customise from the Tools menu and then right click the button. Editing options include changing the button image, changing its display name and assigning a different macro.
Click and drag the button off the toolbar to remove it. Remember, the Customise dialogue box needs to be open.
Add a macro to a button on the spreadsheet
Adding a button to the spreadsheet is easier using the Forms toolbar.
- Click View > Toolbars and select Forms to view the Forms Toolbar
- Click the Button icon
- Draw the button onto the sheet
- On releasing the mouse button the Assign macro dialogue box appears
- Select the macro from the list and click Ok
- Type a name to appear as the label for the button
To format the button, change the button text or assign a different macro at any time, simply right click the button and select the appropriate option.
Add a macro to a graphic object
It is possible to assign a macro to a graphical object such as a shape or a picture.
- Right click on the graphical object
- Select Assign Macro from the shortcut menu
- Select the macro from the list and click Ok