Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50271

Searching a range for red font or red highlighting

$
0
0
Hello guys,

I am trying to program the event Worksheet_SelectionChange so that if a range of multiple cells is selected it searches and counts the number of cells that have either red text or red highlighting. This is what I have so far and it just doesn't do it:

Code:

'red text or highlighted red
    For Each cell In Target
        If cell.Font.Color = 255 Or cell.Interior.Color = 252 Then errorcounter = errorcounter + 1
    Next cell

I already declared cell as a range. This segment of code is part of an event macro with other code in it but the other code shouldn't interfere.

Viewing all articles
Browse latest Browse all 50271

Latest Images

Trending Articles



Latest Images