Count Red Cells

Function CountRed(rRange As Range) As Long
 Dim rCell As Range
 For Each rCell In rRange.Cells
  If rCell.Interior.ColorIndex = 3 Then CountRed = CountRed + 1
 Next rCell
End Function

Here is a more useful version that can be used with various colors (Use the color index for InteriorColor)

Function CountColor(rRange As Range, btInteriorColor As Byte) As Long
 Dim rCell As Range
 For Each rCell In rRange.Cells
  If rCell.Interior.ColorIndex = btInteriorColor Then CountColor = CountColor + 1
 Next rCell
End Function



© Copyright andrewsexceltips.net All Rights Reserved.