In this lesson you can learn how to assign macro to a button (or other object).

First let's prepare some button. Go to Ribbon > Insert > Shapes and select Rectangle.


Insert Rectangle Shape

Then insert the shape in the workbook and name it (if you want).

Insert Rectangle Button

Now right-click on this button and click Assign macro.

Assign macro

Dialog box appears. Choose the macro which you want to assign.

Assign Example Macro

Macro is now assigned to the button. To run the macro just click the button.

To unassign macro right-click on the button. Click Assign macro from the list. Dialog box appears. To unassign the macro just erase macro's name and leave it blank.

Unassign Macro