View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Choose a macro from within a macro

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?