View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default Procedure name as variable

Hi,

Can you not use Application.Run. Run the routine Test where cell A1
contains Macro1.

' Place in standard code module.
Sub Macro1()
MsgBox "Macro1"
End Sub
Sub Macro2()
MsgBox "Macro2"
End Sub
Sub Macro3()
MsgBox "Macro3"
End Sub
Sub Test()

Application.Run Range("A1").Value

End Sub

Cheers
Andy

Redbeard wrote:
Hello all, I hope someone can answer what may be a dumb question. Is it
possible to execute a procedure from a variable? For example, if cell
A1 has the value of "Macro_1" and I have a sub named Macro_1 is there
some way to read cell A1 and convert that value into a sub name I can
execute? I hope that made sense. lol

Thanks for any tips you can give.



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info