Cell ForeColor

  • Thread starter Thread starter JohnZing
  • Start date Start date
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
 
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
 
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:
 

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

Back
Top