Attach Macro to button?

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

Guest

I know how to design a button, and I know how to record a macro but I can't
figure out how to attach the macro to the button?
 
Are you using xl2003 or earlier? Is the button on a command bar (not
embedded in a sheet)? If yes to both:

Tools > Customize
Right Click the button
Choose "Assign Macro"

- David
 
One way to do it is to call it via the click event:

Private Sub CommandButton1_Click() 'Or whatever name
myMacro 'Your macro name here if it is in the standard module
End Sub

If your macro is in a sheet you might have to use Run (macro name)
 

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