Assign a macro to a button

After you create a macro, you can assign it to a button you click to run the macro. You can assign a macro to a button on the Quick Access Toolbar or to a button in your own personal group on the ribbon.

If you want a macro button to be available in other workbooks, assign it to a macro that was created in a personal workbook.

Add a macro button to the Quick Access Toolbar

  1. Click File > Options > Quick Access Toolbar.

  2. In the Choose commands from list, click Macros.

    Commands for Quick Access Toolbar
  3. Select the macro you want to assign a button to.

    A macro name that starts with the name of the personal workbook (PERSONAL.XLSB) will be available in other workbooks.

  4. Click Add to move the macro to the list of buttons on the Quick Access Toolbar.

  5. To replace the rather cryptic macro icon with a different button for your macro, click Modify.

  6. Under Symbol, select a button icon for your macro.

    Modify Button dialog box
  7. To use a friendlier name for the button, in the Display name box, enter the name you want.

    You can enter a space in the button name.

  8. Click OK twice.

The new button appears on the Quick Access Toolbar, where you can click it to run the macro.

Tip:  When you save the workbook, buttons you assign to macros in the personal workbook will be available in every workbook you open.

Add a macro button to your own group on the ribbon

  1. Click File > Options > Customize Ribbon.

  2. Under Customize the Ribbon, in the Main Tabs list, check the Developer box if it is not already checked.

    Customize Ribbon dialog box
  3. Pick the tab where you want to add your own group.

    For example, pick Home, to add your group to the Home tab.

  4. Select New Group.

    That adds New Group (Custom) to the tab you picked.

  5. To use a better name for your new group, click Rename, type the name you want in the Display name box, and then click OK.

    You can enter a space in the name. For example, type My Macros.

  6. To add a macro to the group, in the Choose commands from list, click Macros.

  7. Select the macro you want to add to your new group, and then click Add. The macro is added to the My Macros group.

    A macro name that starts with the name of the personal workbook (PERSONAL.XLSB) will be available in other workbooks.

  8. To use a friendlier name, click Rename, and then type the name you want in the Display name box.

    You can enter a space in the name.

  9. Under Symbol, select a button icon for your macro.

  10. Click OK twice.

Your new group appears on the tab you picked, where you can click the button to run the macro.

Tip:  When you save the workbook, buttons you assign to macros in the personal workbook will be available in every workbook you open.

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×