![]() |
How to assign a macro to a commnd button
I have created a Macro to perform the task of taking the user from one
worksheet to another upon clicking the command button. However when right clicking on my mouse to view the short cut menu for the command button there is no option to assign a macro to the button? The options availabl to me are the format control at the bottom of the short cut menu. How do I activate a Macro on a command button?? |
You can assign macros in the way you want to buttons created from the
Forms toolbar. You've created a button from the Control Toolbox instead. You can use the button's _Click() event to call your macro: Sub CommandButton1_Click() MyMacro End Sub In article , "Mickey Blue Eyes" <Mickey Blue wrote: I have created a Macro to perform the task of taking the user from one worksheet to another upon clicking the command button. However when right clicking on my mouse to view the short cut menu for the command button there is no option to assign a macro to the button? The options availabl to me are the format control at the bottom of the short cut menu. How do I activate a Macro on a command button?? |
In disign mode,right click the button then select view
code. If you have already written the macro you can use the Call command to run it. sample code below. Private Sub CommandButton1_Click() Call YourMacro End Sub good luck -----Original Message----- I have created a Macro to perform the task of taking the user from one worksheet to another upon clicking the command button. However when right clicking on my mouse to view the short cut menu for the command button there is no option to assign a macro to the button? The options availabl to me are the format control at the bottom of the short cut menu. How do I activate a Macro on a command button?? . |
All times are GMT +1. The time now is 01:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com