Embed Macro

[Closed]
Report
-
Posts
4
Registration date
Friday August 31, 2012
Status
Member
Last seen
September 11, 2012
-
Hello,

I hope this isn't too much of a nasty one for Friday afternoon! Any assistance much appreciated.
Is it possible to run a macro inside of another one?

At a certain point within my new macro, I would like to bring up an input box and then run one of three macros depending on what I out in the box.

ie, if I put 1 in the box, then run my old 'Macro1',
if I put 2 in the box, then run my old 'Macro2',
of if I put 3 in the box, then run my old 'Macro3'.

All the macros are saved in the same workbook, if that makes any difference.

Sorry if it's not straight foward.
Thanks for looking,

George


1 reply

Posts
4
Registration date
Friday August 31, 2012
Status
Member
Last seen
September 11, 2012

See if this helps

Sub SelectMacro()

Dim numPick as Integer

numPick = InputBox (Prompt:="1 for Macro1, 2 for Macro2 or 3 for Macro3", Title:="Choose a macro to run")

     Select Case numPick
          Case "1"
               Macro1
          Case "2"
               Macro2
          Case "3"
               Macro3
     End Select

End Sub


In the Select Case, you would change out the names of the macros for "Macro1", "Macro2", and "Macro3" to your actual macro names.