This tutorial shows you how to run a macro from a form button in Excel.
If you do not have a macro to use, then create one. Or, just go through our Hello World lesson. In fact, we will use the macro from our Hello World lesson, in this tutorial.
Steps to run a macro from a form button
Firstly, open your macro file, and follow the steps below to run a macro from a form button.
Steps 1 to 3
- Click Developer from the main menu. The Developer ribbon appears.
- From the Controls group, click Insert. This opens the Controls dropdown menu.
- Select the Button control, from the Form Controls section. After that, click somewhere on the sheet. As a result, the Assign Macro dialog box opens.
Steps 4 and 5
- In the Assign Macro dialog box, select the macro you would like to run.
- Finally, click OK. The button appears on the sheet.
Test it out
So, to test out the form button, simply click somewhere on the sheet, to deselect the button. Then, click on the button. Your macro should run, just like ours below.
Right-click on the button to reveal the shortcut menu. If you want to resize the button, then just click out of the shortcut menu. Also, you can edit the button text from the shortcut menu.
So, did it work for you? If so, then congratulations. Otherwise, give it another shot.
Here is a quick video of this lesson.
- Assign a name to an object in Excel – How to
- Edit a basic macro in Excel – How to
- Hello world in Excel – How to
- Show developer ribbon in Excel – How to
- Use a shape to run a macro in Excel – How to