How can I count the number of cells with a particular color/shade
I made a small typo
Function CountColors(Target As Range, CellColor As String)
Select Case CellColor
Case "Yellow"
SearchColor = 6
Case "Red"
SearchColor = 3
Case "Orange"
SearchColor = 9
End Select
CountColors = 0
For Each cell In Target
If Range("A1").Interior.ColorIndex = SearchColor Then
CountColors = CountColors + 1
End If
Next cell
End Function
"Lynn" wrote:
I have a spreadsheet where I need to count the number cells with each of
these colors/shades: Yellow, Orange, and Red
Thanks, Lynn
|