Microsoft Office Tutorials and References
In Depth Information
Type a description for your macro in the Description box.
Assigning a Macro to a Toolbar Button
Running a macro from inside the Macros dialog box is the easy “built-in” way to do it, but
when you’re moving quickly through a worksheet, the last thing you want to do is dig
through the menu system to open a dialog box, remember the name of the macro you want
to run, and run it. It’s much simpler to assign the macro to a toolbar button so you can run
the macro with a single click of the mouse. You can add a new toolbar button to an existing
toolbar, but it usually makes more sense to create a new toolbar to hold the buttons for your
macros. If you have your monitor set at a relatively low screen resolution to avoid eyestrain,
for example, there won’t be much room on any of the standard toolbars for another button.
Also, if you have toolbar buttons for more than one macro, it might be difficult to pick the
button out of a crowd on a densely populated toolbar. If you put your macro toolbar buttons
on a toolbar clearly labeled as your custom macro toolbar, you’ll have a much easier time
finding your macros and remembering which button is which.
To create a new toolbar, add a button to it, and assign a macro to the button, follow these steps:
Click Tools, Customize. Then, if necessary, click the Toolbars tab to display the
Toolbars tab page of the Customize dialog box.
Click New. Then, in the Toolbar Name box, type the name of the new toolbar and then
click OK to create the toolbar.
In the Customize dialog box, click the Commands tab.
In the Categories list, click Macros.
Drag the Custom Button command to your new toolbar.
On the new toolbar, right-click the button you just added, click Name, type a name for
the button, and press Enter.
On the Custom Macros toolbar, right-click the new button and click Assign Macro.