command button and macros

G

Guest

After placing a command button on a worksheet, how do I go about assigning a
macro to that command button. And, can there be more than one button
controlled macro on a worksheet?

Thank You,
Brian
 
J

Jason Morin

While in design mode, right-click the button and go to
View Code. Insert your code.

HTH
Jason
Atlanta, GA
 
A

Alan

If you're talking about a button from the View > Toolbar > Forms menu then
simply right click the button, Assign Macro and select the macro.
And yes, you can have as many buttons firing the same macro as you like, and
you can have multiple buttons on a sheet firing multiple macros,
Regards,
 
G

Guest

i tried this except when a right clicked on the button there was no assign
macro option, what could be the problem
 
G

Gord Dibben

Brian

The problem could be that you created a button using the Control Toolbox.

Right-click and "View Code". Paste your code or a call to your code in there.

Alternative.........

Create the button using the Forms toolbar. That one has the right-click
"assign macro".

Gord Dibben Excel MVP
 

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