I'd like to set up a sub to call another sub based on a value in a cell, rather than calling a specific pre-defined sub.
For example:
Unfortunately 'call x' doesn't work as I had hoped.
The intention is that, in the above example, when test1 is run, if the value in B2 is "test2", test2 will be called; if the value in B2 is "test3", test 3 will be called.
Does anybody know of a way to make this work?
For example:
Code:
Sub test1()
x = Worksheets("Sheet1").Range("B2").Value
Call x
End Sub
Sub test2()
Worksheets("Sheet1").Range("B4").Value = "test2 has run"
End Sub
Sub test3()
Worksheets("Sheet1").Range("B4").Value = "test3 has run"
End Sub
Unfortunately 'call x' doesn't work as I had hoped.
The intention is that, in the above example, when test1 is run, if the value in B2 is "test2", test2 will be called; if the value in B2 is "test3", test 3 will be called.
Does anybody know of a way to make this work?