ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macros - call or launch from fromula (https://www.excelbanter.com/excel-programming/275995-macros-call-launch-fromula.html)

Paul

Macros - call or launch from fromula
 
can I launch or call a macro from an @IF() statement in a
cell? If so, what is the propoer synatax.

Thanks

B. Paul Welch
San Diego

Andy Wiggins[_2_]

Macros - call or launch from fromula
 
No, you can't launch a macro as the result of an IF statement. However, take
a look at worksheet events - these are probably what you need.

--

Regards
Andy Wiggins
www.BygSoftware.com
Home of "The Excel Auditor" and "Byg Tools for VBA"



"Paul" wrote in message
...
can I launch or call a macro from an @IF() statement in a
cell? If so, what is the propoer synatax.

Thanks

B. Paul Welch
San Diego




Heapy

Macros - call or launch from fromula
 
Paul; you can create a user-defined function (UDF) which is callable from
within your =IF function....

For example, if you'd like to create an IF function that checks if the text
color in a particular cell is red, you could write something like this:

Function CheckColor(CellRef As String)
Dim CC As Long
On Error GoTo ERR1
CC = Range(CellRef).Font.Color
CheckColor = CC
GoTo DONE
ERR1:
CheckColor = "#N/A"
DONE:
End Function

.... and then in your =IF function, write something like this:

=IF(CheckColor(CELL("address",A32))=255,"yes it's red","something other than
red")

Hope this gives you some ideas.

HWH


"Paul" wrote in message
...
can I launch or call a macro from an @IF() statement in a
cell? If so, what is the propoer synatax.

Thanks

B. Paul Welch
San Diego





All times are GMT +1. The time now is 10:49 PM.

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