Cell ForeColor

J

JohnZing

Hi,

i need some ideas to implement a formula like ...

=IF(CellForeColor(D2)=RGB(255,0,0),"R","B")

if cell D2 text color is Red then the value will be "R", "B" if not.

thank you
 
C

Carl Brehm

Function CHECKCOLOR(CL As Range) As String
Dim NUM As Integer


NUM = CL.Interior.ColorIndex
Select Case NUM
Case 6
CHECKCOLOR = "Y" 'YELLOW
Case 5
CHECKCOLOR = "B" 'BLUE
Case 46
CHECKCOLOR = "R" 'RED
Case Else
CHECKCOLOR = ""
End Select

End Function

= checkcolor(d2)
If you change a color you will have to force a calculation with Ctrl-Alt-F9
--
Carl & Linda Brehm
Lake Lafourche Bird House
Hebert, LA

Keets, Tiels, GN Lories, Quakers
Mitred Conures, TAG's, Bourkes
Lovebirds, Cherry Head Conures
Prince of Whales

Wholesale Cages to Breeders & Pet Stores
 
J

John Zing

thank you for your reply, but your code work well with cell background.
I need to evaluate the text color.

Carl Brehm said the following:
 
Top