You can do this a few ways depending on what you prefer.
1.) Put this code in Worksheet Module or the worksheet you wish to test. I
think this may get a bit annoying but it will do the trick.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Font.ColorIndex
Case Is = 1
MsgBox "The Font ColorIndex = 1 or Black"
Case Is = 6
MsgBox "The Font ColorIndex = 6 or Yellow"
End Select
End Sub
2.) You can call a user defined function from a cell, which will return
Black or Yellow.
Public Function DetectFontColor(CellToDetect As Range) As String
Select Case CellToDetect.Font.ColorIndex
Case Is = 1
DetectFontColor = "Black"
Case Is = 6
DetectFontColor = "Yellow"
End Select
End Function
3.) You could use the immediate window in the
VB Editor. Just select a cell,
then in VBE select ViewImmediate Window then type this:
?ActiveCell.Font.ColorIndex
This will give you the colorindex number.
I hope one of these helped! If so, please let me know and click "YES" below.
--
Cheers,
Ryan
"kirkm" wrote:
I'm wanting to detect if the font colour in the selected cell is black
or yellow.
Been playing with target. and the drop down items but can't see
anything (yet).
Any help appreciated.
Thanks - Kirk