View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Heapy Heapy is offline
external usenet poster
 
Posts: 14
Default 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