Excel > Excel 2007 Advanced > Macros

Assign a Macro to a Button

You can run a macro from a button on the Quick Access Toolbar, a button on the sheet or any other graphic control.

Add a macro to the Quick Access Toolbar

  1. Click the Customise Quick Access Toolbar button.
  2. Customise Quick Access Toolbar button

  3. Click More Commands
  4. Click the Choose commands from drop list and select Macros
  5. Add a macro to toolbar

  6. Your macros appear in a list. Select the macro to add to the toolbar and click the Add button
  7. To change the button picture, click the Modify button below the list. The buttons display name (name that appears when you point to the button) can also be changed.
  8. Modifying the macro button
  9. Click Ok to close the Modify Button dialogue box and then Ok again.

The button can now be seen on the Quick Access Toolbar and is just one click away whenever needed.

To remove a button from the Quick Access Toolbar, simply right click the button and select Remove from Quick Access Toolbar.

Remove macro from toolbar

Add a macro to a button on the spreadsheet

To add a button to the spreadsheet, the Developer tab is required. If you do not have the Developer tab on the Ribbon, you will first need to show the developer tab.

  1. Click the Office Button and click Excel Options
  2. Click the Show Developer tab in the Ribbon checkbox
  3. Show the Developer tab on the Ribbon checkbox

  4. Click the Developer tab
  5. Click Insert and then select the Button from Form Controls
  6. Inserting a Command Button

  7. Draw the button onto the sheet
  8. On releasing the mouse button the Assign macro dialogue box appears
  9. Assign a macro to a button

  10. Select the macro from the list and click Ok
  11. 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.

Editing the button

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.

  1. Right click on the graphical object
  2. Select Assign Macro from the shortcut menu
  3. Assigning a macro to a shape

  4. Select the macro from the list and click Ok

Follow us on

Facebook  Twitter  You Tube