Conditional Macro execution based on a variable

  • Thread starter Thread starter KG Old Wolf
  • Start date Start date
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-
 
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
 
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-

------------------------------------------------------------------
 
Back
Top