Site Map
menu 1
menu 2
menu 3
menu 4
menu 5
menu 6
 
Onsite Training
Since 2003, iCellini Computer Training has been San Diego's number one choice for onsite computer training.

How to Record and Run a Macro
Part 3: Running a Macro

By John Cellini
Published on August 31, 2007

In Part 1, we demonstrated a couple of ways to run a macro. First we ran our macro from the Macro dialog box (Tools --> Macro --> Macros). We will learn much better ways to run a macro.

We also used a shortcut key to run our macro. If you assign a shortcut key to run your macro, you need to be careful not to assign a shortcut key that has already been assigned. For example, if we assign Ctrl + C to a macro, we can no longer use that shortcut key to copy cells. The macro shortcut key will override the default shortcut keys. It's far better to assign Ctrl + Shift + C so you can use Ctrl +C for its intended purpose.

Using a shortcut key to run a macro requires you to keep track of what shortcut key is used for the macro. If you have a number of macros, you either have to memorize the shortcut keys or look them up in the Macro dialog box (click on the options button). That is a bit cumbersome. There are better ways to run a macro. We will look at two other methods.

Assigning a Macro to a Toolbar or Menu

You can create a toolbar button or a menu item that will run your macro when you click on one or the other. Now that's a convenient way to run your macro! In the following exercise, we will create a toolbar button and a menu item to run the macro we created in Part 1. Whether you assign your macro to a toolbar or menu, the procedure is the same.

Open the macro_practice.xls workbook you created in Part 1.

Open the Customize dialog box (right click any toolbar button or menu item and choose Customize at the bottom of the shortcut menu).

Click on the Commands tab and select Macros from the Categories list.

Customize dialogbox

Now we will add a button to the Standard toolbar and add a menu item to the Insert menu. Keep in mind that we would normally add one or the other and not both, but for demonstration purposes we are adding both. Also keep in mind that you can add a custom button to any toolbar or a custom menu item to any menu.

Drag the Custom Button from the Commands list to the Standard toolbar and release it somewhere on the toolbar.

Drag the Custom Menu Item to the Insert menu. When the menu opens, release the menu item somewhere within the menu.

page 1 | 2 | 3 | next page >>