Jack here is one solution, there are a number
of ways to do it, and probably better
Function CountColorCode(Range, CCode)
Set YourDataRange = Intersect(Range.Parent.UsedRange, Range)
kount = 0
For Each cell In YourDataRange
If cell.Interior.ColorIndex = CCode Then kount = kount + 1
Next cell
CountColorCode = kount
End Function
The only draw back on this is it will not give
you the correct answer if the cell is conditionally
formated. I'll look at another method latter.
regards
Ivan
Sorry jack forgot to comment it (was in a rush to
answer Q from another group)
This is a User defined function that uses
your selected "range" and Color code "CCode"
For the codes of the colors see Online Help re: color codes.
Paste this function into a module via
Alt F11, select VBA project, insert Module.
Jack here is one solution, there are a number
of ways to do it, and probably better
Function CountColorCode(Range, CCode)
Set YourDataRange = Intersect(Range.Parent.UsedRange, Range)
kount = 0
For Each cell In YourDataRange
If cell.Interior.ColorIndex = CCode Then kount = kount + 1
Next cell
CountColorCode = kount
End Function
The only draw back on this is it will not give
you the correct answer if the cell is conditionally
formated. I'll look at another method latter.
regards
Ivan