MrExcel Publishing
Your One Stop for Excel Tips & Solutions

run macro dependent on value in cell a1

Posted by thomas venn on June 08, 2001 10:36 AM


i have a formula in cell a1 which turns into a value. this value in cell a1 is exactly the same as the name of my macro. i want to know if i can have the macro run based on the value of cell a1.
for example, i can run the following macro --- Application.Run "Num_of_Columns" with no problems. but in this new situation, i want to run something like --- Application.Run "Range("A1").Value.Select"

the reason i need this is because i have multiple macros, and the one that gets run depends on the value from cell a1.

thank you in advance.


Posted by Barrie Davidson on June 08, 2001 11:03 AM

Hi Thomas, how about declaring a variable and using that as your code parameter. For example,
Dim Macro_Name As String
Macro_Name = Range("A1").Value
Application.Run Macro_Name