determine font color in cell

  • Thread starter Thread starter deadfish
  • Start date Start date
D

deadfish

Hi,

I would like to sum the value of the cells if the font color in th
cells are red. I have try the UDF in the previous:

Function CellColour(rng As Range, Optional text As Boolean = True)
If rng.Count > 1 Then
CellColour = CVErr(xlErrValue)
Else
If text Then
CellColour = rng.Font.ColorIndex
Else
CellColour = rng.Interior.ColorIndex
End If
End If
End Function

But as the author said "it doesn't update automatically if the cel
colour is changed though.". How to make it update automactically whe
the font color changed? Or any other UDF can achieve this?

Thanks
 
Hi
short question: You can't. The best you can achieve is adding the line
application.volatile
at the beginning of your macro.< this way it is always re-calculated
then ANY cell changes its value. Note: format changes do NOT trigger a
re-calculation
 
Back
Top