I know this is foolish. I have a spreadsheet that is color coded beyond belief. Because of its complexity, we need to be able to count how many of each color are in the range. I have that one figured out by using the following:
Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
Dim Rng As Range
Application.Volatile True
For Each Rng In InRange.Cells
If OfText = False Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng
End Function
The problem is that we are now using strikethrough characters and need to count those separately. I can't seem to get that one. Anyone see what I can do? I know this is probably an easy one, but my brain hurts.
-Dave
-Dave the Perpetually Confused
Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
Dim Rng As Range
Application.Volatile True
For Each Rng In InRange.Cells
If OfText = False Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng
End Function
The problem is that we are now using strikethrough characters and need to count those separately. I can't seem to get that one. Anyone see what I can do? I know this is probably an easy one, but my brain hurts.
-Dave
-Dave the Perpetually Confused