ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   usgin a macro within an IF statement (https://www.excelbanter.com/excel-programming/304738-re-usgin-macro-within-if-statement.html)

Tom Ogilvy

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)






All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com