Can I use a variable contain the name of a sub or function tocall it?
hi,
Sub test()
Dim mc As String, nb As Integer
nb = Application.InputBox(prompt:="Choose a number between 1 and 10", Type:=1)
If nb 5 Then mc = "This" Else mc = "That"
Call MyCode(mc)
End Sub
Sub MyCode(SubName As String)
Application.Run (SubName)
End Sub
Sub This()
MsgBox "This"
End Sub
Sub That()
MsgBox "That"
End Sub
--
isabelle
|