Excel 2002 Command Button

  • Thread starter Thread starter Ray Cole
  • Start date Start date
R

Ray Cole

Hi,

In Excel 2002, the help section says to add an existing
macro to a command button you need to right click on the
sizing handles of the button and select assign macro.

I do not get this option from the shortcut menu. Have I
turned something off accidently?

Ray
 
Ray,

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 (Tools>Customize>Toolbars)
- 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

--

HTH

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

Thank you for the advice, you were right about being a
control button not a forms button.

Can you tell me with a control button how I insert or
call an existing macro once I'm in the VB screen.

Thanks
Ray
 
Ray,

Just insert the name of the macro to be called in the Click event
of the command button. For example,

Private Sub CommandButton1_Click()
MyMacro
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top