Currently I am experiencing issues with passing the value of a cell and its respective text color to my user defined function. I am passing the references as ranges and using .Font.ColorIndex. This is then used in a IF statement to determine if any are red (value of 3) and then application.caller.fontIndex=3 to turn the cell text red.
Public Function Example(AA As Range, BB As Range) As double
Dim AAcolor, BBcolor As Integer
AAcolor=AA.font.colorindex
BBcolor=BB.font.colorindex
IF BBcolor=3 Or AAcolor=3 Then
Application.caller.font.colorIndex=3
End If
The rest of the code is simply formulas that calculate a double from the ranges inputted which is returned as a double.
To clarify, I am trying to determine the color of the text of the referenced input cells. I am not limited to a UDF to do this if I can call the sub from my UDF.