Be the first user to complete this post
|
Add to List |
Assign a Macro to a Button
In Earlier session we saw how to add a button to the top menu of the Excel file (How to Get Access to the ToolBar)
In the Code window we have created two sub routines
Sub Assign_Macro1 ()
....Some Code....
End Sub
Sub Assign_Macro2 ()
....Some Code....
End Sub
Now you can assign it to button .
To get the Button on the Excel, Click and Hold the Button icon in the Top menu of the Excel and Then Click + Hold + drag in Excel Sheet (WorkSheet) to give it proper size.
For the very first time when you create a button another window will prompt automatically to assign Macro to that button
You can click cancel and Assign the Macro later to this Button
you can see that Sheet1.Assign_Macro1 and Sheet1.Assign_Macro2 macro’s are displayed, you can select any of these and click OK. Now when next time when you click the button the select sub routine will be called.
You can change the Assigned Macro or re-size the button or Edit the Text on the button or any other kind of formatting by right click on the button and select the appropriate option from the menu.
Also Read:
- Password Protection to Your Macro Code
- Add Tools to Quick Access Tool Bar(Excel Top Bar)
- Excel Macro - Visual Basic Editor
- How to Enable Macro in Excel
- VBA Codes - Record Macro