Forum Discussion
Mezamir
Dec 24, 2024Copper Contributor
Color of the letter in a cell
I have not used Excel for several years. Now, I have a problem reading the color code of a letter in a cell. – see the attached example. I think UDF will be a helpful solution, but I don't remem...
- Dec 26, 2024
For example:
Function GetColor(cell As Range, Optional ofFont As Boolean = True) As Long Application.Volatile If ofFont Then GetColor = cell.Font.Color Else GetColor = cell.Interior.Color End If End FunctionUse like this:
=GetColor(B2)
to get the font color, or
=GetColor(B2, FALSE)
to get the fill color.
Warning: the formula result will not be updated automatically when you change the color. Press F9 to force the formula to recalculate.
Mezamir
Dec 27, 2024Copper Contributor
I am slightly confused by the results. Do you have any explanations?