How to Assign a Macro to a Button in Excel

In this article, we shall learn how to assign a Macro to a button in Excel. Let’s start.

This article is part of my series: Excel VBA & Macros – A Step by Step Complete Guide.

(Step by Step) How to Assign a Macro to a Button in Excel

After you have recorded and tested a macro, you may want to assign your macro to a button placed in a worksheet. You can follow these steps to do so:

    1. If your macro is a general-purpose macro and you plan to use it in more than one workbook, make sure that this macro is stored in your Personal Macro Workbook.
    2. Choose Developer ➪ Controls ➪ Insert, and then click the icon identified as Button (Form Control). To find out the form control button, move your mouse pointer over the icons, and you will see a ToolTip that will describe the control. See the following figure.
how to assign a macro to a button in Excel

Form Control Button.

    1. Now select the worksheet and drag in the worksheet to draw the button. Whenever you release the mouse button, the Assign Macro dialog box will appear.
    2. Select the macro from the list.
    3. Click OK to close the Assign Macro dialog box.
Assigning a macro to a button

Assign Macro dialog box.

  1. A button will appear in the worksheet. You can change the text that is displayed on the button to make it descriptive. To do so, right-click the button, choose Edit Text from the shortcut menu, and make your changes.
Assigning a macro to a button

Click this button to activate the TimeStamp macro.

Click the button and the Macro will be activated

After performing these steps, select any cell in the worksheet and click the button to execute the assigned macro in it.

Download Working File

Time-Stamp.xlsm

Happy Excelling 🙂


Hello! Welcome to my Excel blog! I am conducting deep dives into the world of Excel. Please join with me and explore Excel deeply. Keep in mind this African proverb: "If you want to go fast, go alone, If you want to go far, go together." Let's together explore Excel deeply! ☕

We will be happy to hear your thoughts

      Leave a reply