Excel 2002 Command Button

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
 
B

Bob Phillips

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)
 
R

Ray Cole

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
 
C

Chip Pearson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top