Run a macro by the number typed in a box/button

M

mcicoff

I want to create a box or button in which I may type a number to run th
associated macro.
For example: My goal is to sort data for each day of the month. I ma
currently create 31 macro's and 31 buttons, but I would like to have on
button/box to run the day that is in need of sorting. I will have 3
macro's, but only one button. Is this possible
 
J

johncassell

I know this may be slightly longer winded than just a text box sat o
the screen but hope this helps or at least points in the righ
direction...

Keep your button on the sheet and have it call the Macro "InputBox"
-------------
Sub InputBox()
macro = Application.InputBox("Enter Macro Number")
Run ([macro])
End Sub
------------

Clicking your button will now open an input box which asks for th
macro name you would like to run. If you had a macro called "Print" an
entered Print in this box then that macro would run.

Joh
 
B

Bob Phillips

How about

Application.Run "Macro" & Day(Date)


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 

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