How do I calculate number of colored cells?
This is pretty much what Gary did, but I tweaked it a bit. This will give
you the total in the next cell under your range. I'm not sure how you get
your range, but you can select it likes Gary's code or if the range is always
positioned in the same address you can use mine.
Option Explicit
Sub NoColorCellCounter()
Dim MyRange As Range
Dim d As Range
Dim i As Long
MyRange = Range("A1:A10")
i = 0
For Each c In MyRange
If c.Interior.ColorIndex = xlNone Then i = i + 1
Next c
MyRange.Offset(1).Value = i
End Sub
Hope this helps! If so, click "YES" below.
--
Cheers,
Ryan
"Rui" wrote:
Hi to master gurus in excel,
I really need your help to solve one issue: how to calculate number of
collor cells?
For instance, from cells range A2:F2 (6 cells),if there are 2 cells filled
in any colors, the counter in cell G2 should be equal to 4(6-2).
Any thoughts?
--
Thanks in advance!
|