In an Excel file, to run the VBA program, you have to finish several steps. So today we will launch two ways to insert VBA Button in Excel.
If you want to run a macro, you will often press the shortcut key “Alt + F11” to open the windows of VBA. And then, you click the button “Run Macro” in the toolbar. The other way is: click “View” -> click Macro -> choose the Macro -> click “Run”.
Alternatively, we can use the following two ways to invoke the VBA scripts more easily.
Insert Button into Worksheet.
- Click the button of “File” in the ribbon.
- Then click “Option”.
- Then in the “Excel Options”, click “Customize Ribbon”.
- And then check the option of “Developer”.
- And click “OK”. And the “Developer” tab will appear in the ribbon.
- In the “Developer”, click “Insert”.
- And then click “Button” in the new menu.
- And then you will find that the shape of mouse becomes “+”. So you can drag mouse and draw a button in your target worksheet.
- After that, you will see a new window. Choose the macro to link to the button.
- And then click “OK”.
After all the steps, now you can click this button and the VBA program will run.
The next time you need to run the program, you can still use this button. Besides, you can also change the button name.
Insert Button in the Quick Access Toolbar
- Click the small arrow on the quick access toolbar.
- In the drop-sown menu, click the option of “More Commands”.
- And then select “Macros” in the commands.
- And then select the name of the VBA program.
- And then click “Add”.
- Then click “OK”.
- And in the quick access toolbar, you will see the button.
And also click this button, you can run your VBA program.
Comparison between the Two Ways
|Button in Worksheet||Button in Quick Access Toolbar|
|Similarities||1. Both of the two methods can run the VBA programs quickly.
2. Once the buttons are set, the manipulation will be more convenient.
|Differences||It can only work on the worksheet where we put the button.||This VBA code should be universal, so all other Excel files can also use this button to run the macro.|
Excel File Corruption Measures
Excel files can sometimes corrupt due to many different reasons. To prevent worse things from happening, you can use a third party tool to fix Excel files. And don’t worry about losing your data, because this tool is very powerful.
Anna Ma is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including word recovery and outlook repair software products. For more information visit www.datanumen.com