Assigning a macro to a command button

G

Guest

I posted this question earlier today but I forgot to mention an important
item. The right click, assign macro choice is not available with the button I
used (the command button on the control toolbox.) Here's the earlier post.

I accidently used the wrong button and am hoping there is a fix. I need to
run a macro from a button.

I know that if I use the button (control button) from the forms toolbar the
first thing it asks me to do is to assign a macro and all would work fine.
But...

I used the command button from the control toolbox to make the buttons (I
made many of them and would prefer not to remake them). I would like to run a
macro from each of these buttons and now I can't figure out how to attach the
macro to the buttons I've already made. The buttons came from the command
button on the control toolbox.

Is there a way to attach a macro to these buttons?? THANKS !
 
G

Guest

Macros are "assigned" to those buttons in the SheetModule.........here's a
typical example........

Private Sub CommandButton1_Click()
Call YourMacroName
Sheets("Notes").Select
Application.Goto Reference:="R500C1"
Application.Goto Reference:="R72C1"
MsgBox "Hey!....you just pushed my button!"
End Sub


hth
Vaya con Dios,
Chuck, CABGx3
 

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