Function CountFormat(inRange As Range, CI As Integer) As Integer
Dim myCell As Range
For Each myCell In Intersect(inRange.Parent.UsedRange, inRange)
If myCell.Interior.ColorIndex = CI Then
CountFormat = CountFormat + 1
End If
Next myCell
End Function
Used like
=CountFormat(A:A,6)
to count all the bright yellow cells in column A.
You can determine the proper colorindex by recording a macro where you apply
that color to a cell.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.