Command buttons & macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I allocate a macro to a command button?
Right clicking a command button which is in design mode brings down a drop
down menu but 'assign macro' isn't on option.
 
Jock,

Sounds like you have control toolbox button.. Assuming so, when in design
mode, double-click the button, and then will open up the worksheet code
module, and create a skeleton click event which would be where you add your
code.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Jock,

Command buttons have their own event handlers. Double-clicking one will
take you to it, something like:

Private Sub CommandButton1_Click()
' you could call your macro in here
' or just put the code here
End Sub

This event handler lives in the sheet module, like worksheet_change and
other events.
 
Thanks to Bob and Earl. Job done

Earl Kiosterud said:
Jock,

Command buttons have their own event handlers. Double-clicking one will
take you to it, something like:

Private Sub CommandButton1_Click()
' you could call your macro in here
' or just put the code here
End Sub

This event handler lives in the sheet module, like worksheet_change and
other events.
 

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

Back
Top