Conditional Macro execution based on a variable

K

KG Old Wolf

I want to assign multiple macros to a toolbar "button" and execute the right
macro based on a DropDown list's selection: ie-

Press "button"
examine value from dropdown list
choose the correct macro
execute
-----------------------------------------
I have the (4) macros written and working (via recorder) and could assign
them to separate "buttons" but I know there is a more professional way to do
this...

Thanks,
KG-
 
J

Jacob Skaria

Use Select/Case

Sub Macro()

Select Case Range("B1")
Case "a"
Run "macro1"
Case "b"
Run "macro2"
Case "c"
Run "macro3"
End Select

End Sub

If this post helps click Yes
 
K

KG Old Wolf

OUTSTANDING! and thank you very much.

As you can tell, I am just beginning to go beyond the macro recorder for
purposes of automating certain functions within the spreadsheet.....

Again, thank you
KG-

------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top