Macro dialogue box doesn't appear when a button is added?

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

Guest

Having created a Macro and then used the control button Icon with the intent
of running the Macro no dialogue box appeared. I cannot, therefore select
the Macro to attache it to the button. I don't know any other way of
connecting the button to the Macro?
 
Hi SJL

Having created the button, right click on it, and click on View Code. You
will notice that the Private Sub CommandButton1_Click() sits under the
Worksheet in which you created it. The macro you created, on the other hand,
is under Module 1.

Say your macro name is Macro1(). Between Private Sub CommandButton1_Click()
and end sub, in the blank line, enter the word Macro1. Return to the
worksheet, click on the Edit button on your control toolbar. If you now
click on the button you created, it will run your macro. You can of course
personalise your button, by clicking on properties, and changing the
properties you want, eg the caption.
 
Back
Top