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

S

SJL

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?
 
K

Kassie

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.
 

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