How to Assign a Macro to a Button in Excel

In this Excel tutorial, you will discover how to effortlessly assign macros to buttons or other objects in Excel, streamlining your workflow for frequently used tasks.

Creating a Button

Let’s start by creating a button:

First, let’s prepare a 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

Assigning a Macro

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. Once you’ve finished customizing the button, you can test it by clicking on it. The macro you assigned should run, and you should see its effects in the worksheet.

Unassigning a Macro

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

These straightforward steps empower you to effortlessly assign and unassign macros to buttons in Excel. This efficient approach allows you to execute frequently used macros swiftly, bypassing the macro dialog box and optimizing your productivity.

See also  How to Loop Through Rows and Columns in a Range