Run a macro using a command button

T

Tdahlman

I have created a macro using the Macro Recorder.
I have a command button and I want to run the macro (which is names
DATASORT) when I click the button.

Please advise how to make this work.

Thanks in advance,
Travis
 
P

PCLIVE

This will depend on the type of command button you created. Right-click
your command button. If there is an option to "Assign Macro", then that's
how you do it. If not, then click "View Code"

Enter this text.

Call <your macro name, no brackets>


HTH,
Paul
 
J

Jason

Go to "View" & "Toolbars". Show the forms toolbar.

Click the "button" button. (I know it doesn't make sense, but if you hover
your cursor over, it will say "button")

You'll get a cursor where you can drag & drop a button.

Once you have the button, right click & choose "assign macro".
 
F

FSt1

hi
on the toolbox toolbar, chick design mode. the icon looks like a protractor
with ruller and pencil. in design mode right click the button. from the
popup, click view code. add this......
Private Sub CommandButton1_Click()
call DATASORT
End Sub
close the vb window.
if you need to relocate or resize the button, do so now.
click design mode icon again to exit design mode.
done. button is live.

Regards
FSt1
 
B

Bob I

FSt1 said:
hi
on the toolbox toolbar, chick design mode.
--------------------------^^^^^^^^^^^^^^^^^
What version you got, and where can I get one?! ;-)
 
F

FSt1

hi
2002
on the menu bar...
tool>customize>toolbars>check control toolbox

regards
FSt1
 
P

PCLIVE

It's just funny. Wouldn't be great to have a "chick design mode" in Excel.
;-)

--
 

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