View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default usgin a macro within an IF statement

In a general module

Public Function Macro1()
set rng = Application.Caller
Macro1 = rng.Address
End Function

Public Function Macro2()
set rng = Application.Caller
Macro2 = rng.Parent.Name
End Function

Note that a function used in a worksheet can only return a value to the cell
in which it is contained. It can't do formatting or otherwise change the
Excel environment.

--
Regards,
Tom Ogilvy



"fred" wrote in message
...
does anyone know how to use a macro within an IF statement?
for example: If(A2=10,Macro1,Macro2)