VBA for Office Suite or Virtual Basic For Applications is becoming popular among Office professionals. It is now a powerful programming tool for users and the best thing about VBA is that you can use it even if you don’t know anything about coding. In VBA, we have macros, which are objects that we create for customizing certain functions. We then call these macros and run them for our own requirement.
Creating a macro and calling the macro functions are pretty easy. But there are many people who are non-technical and migh need to use the macro while working in MS Excel Sheet. For example, in my previous article How To Sort items In An Excel Worksheet Using Excel VBA . If you want to use this macro, then you have to select the macro from the Macro Tab under Developer menu, or press the shortcut key created for specific macro. But there may be some people, who can’t perform all these steps. For them, you can create some simple buttons, which they will press in order to call the macro function.
In this article, we shall see how to create a button for a Macro in Excel VBA.
Steps To Create A Button For Macro In VBA For MS Excel
We assume, that you have created the macro for which you want to create a button. Go to the Developer tab, click on Insert menu, and select Button from the list of Form Controls.
Next, drag and draw a square in the area where the button is to be placed.
Next, the Assign macro dialog box, opens. Select the required macro. Click OK.
The button is created. Rename the button to a relevant name.
Finally it is done.