Thread: Command buttons
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Command buttons

Hi Craig,

You have probably have a control button, not a forms button.

You can't assign a macro to this, it uses event (such as click) code. To
access this,
- open the Control Toolbox toolbar (ToolsCustomizeToolbars)
- go into design mode (click the blue-green triangle icon)
- now double-click the button, and it will take you in to the code event for
click where you can add the code, or even call your macro
- exit design mode

You can call your macro from the command button event code like so

Private Sub CommandButton1_Click()
MyMacro
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Craig" wrote in message
...
I'm trying to do something I haven't done in a long time. Put a command

button on a worksheet and assign a macro to the button. I have the button
on the sheet OK, but when I get the sub-menu, "Assign Macro" is not in the
menu. Before I created the button I recorded the macro. What is my
problem? What am I missing? How do I do this? Excel 2003. Thanks.