ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Assign a macro to Command Button Object (https://www.excelbanter.com/excel-discussion-misc-queries/35014-assign-macro-command-button-object.html)

dallin

Assign a macro to Command Button Object
 
When I right click on my command Button to locate the option of assign to
macro its not their. How do I get the option to assign to macro to appear?
The other options are available to me on the command button but not the
assign to macro???
--
thanks, mc

Norman Jones

Hi Dallin,

If the button is from the Control Toolbox, double-click the button which
will take you to the sheet module and provide you with a macro stub for the
CommandButton something like:


Private Sub CommandButton1_Click()

End Sub


Insert insert the body of your macro between the two stub lines.

Alternatively, if the macro you want to use is in a standard module, simply
add the line:

Call MyMacro

between the stub lines, replacing 'MyMacro' with the name of your macro.


---
Regards,
Norman



"dallin" wrote in message
...
When I right click on my command Button to locate the option of assign to
macro its not their. How do I get the option to assign to macro to
appear?
The other options are available to me on the command button but not the
assign to macro???
--
thanks, mc




Anne Troy

Please see:
http://www.officearticles.com/misc/m...ica tions.htm
*******************
~Anne Troy

www.OfficeArticles.com


"dallin" wrote in message
...
When I right click on my command Button to locate the option of assign to
macro its not their. How do I get the option to assign to macro to

appear?
The other options are available to me on the command button but not the
assign to macro???
--
thanks, mc





All times are GMT +1. The time now is 02:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com