determine font color in cell

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
 
F

Frank Kabel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top