Call Sub From InputBox

J

John Cole, Jr.

I have written a macro that will loop through every workbook in a
certain directory. I would like to use that for several other macros
that will do things in the workbooks. Is there a way, I can use an
InputBox to call the routine/sub I want to run with the Loop
procedure?

Thanks in Advance,

JC
 
J

John Cole, Jr.

how about
call inputbox("Enter sub to call")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)






- Show quoted text -

Tried that, and I got an error.

JC
 
G

Guest

Use the brute force approach

Add string names for the function in the test box like
Function1 Function2 Function3

then read input box
FunctionName = inputbox.text

then use a select function to do the call

select case Function Name
Case "Function 1"
call Function1
Case "Function 2"
call Function2
Case "Function 3"
call Function3
end Select
 
J

John Cole, Jr.

Sorry. try this
Application.Run InputBox("Enter sub to call")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)






- Show quoted text -

....Like a charm.
Thanks a lot!

JC
 

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