Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to write a macro which will choose one of two macros to run, based
upon the value in a single cell. The value in the single cell could be either numeric or text. In other words, IF cell value = x, Application.Run"Macro1", ELSE Application.Run "Macro2". But I just don't know how to write the proper code for this. Any clues? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this:-
Sub ordinate() x = 6 If Cells(1, 1).Value = x Then macro1 Else macro2 End If End Sub Sub macro1() MsgBox ("Macro1 running") End Sub Sub macro2() MsgBox ("Macro2 running") End Sub "Felicity Shagwell" wrote: I need to write a macro which will choose one of two macros to run, based upon the value in a single cell. The value in the single cell could be either numeric or text. In other words, IF cell value = x, Application.Run"Macro1", ELSE Application.Run "Macro2". But I just don't know how to write the proper code for this. Any clues? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey Mike,
Thanks for that! "Mike H" wrote: Try this:- Sub ordinate() x = 6 If Cells(1, 1).Value = x Then macro1 Else macro2 End If End Sub Sub macro1() MsgBox ("Macro1 running") End Sub Sub macro2() MsgBox ("Macro2 running") End Sub "Felicity Shagwell" wrote: I need to write a macro which will choose one of two macros to run, based upon the value in a single cell. The value in the single cell could be either numeric or text. In other words, IF cell value = x, Application.Run"Macro1", ELSE Application.Run "Macro2". But I just don't know how to write the proper code for this. Any clues? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Choose Which Macro to use | Excel Programming | |||
CHOOSE TO STOP A MACRO OR NOT | Excel Programming | |||
Help with macro to choose printer | New Users to Excel | |||
How do I set up macro in VBA to choose worksheets? | Excel Programming | |||
Choose Function Macro | Excel Programming |