I need to create a UDF that will count all cells of a certain color. There are hidden rows in the worksheet. I do not want to count the hidden rows. Can you help me? I created the CountColor function and it is working well.
I just need to exclude the hidden cells or rows in the count. any help you can provide me is greatly appreciated.
Thank you
Darlene
Function CountCcolor(range_data As Range, criteria As Range) As Long
Dim datax As Range
Dim xcolor As Long
xcolor = criteria.Interior.ColorIndex
For Each datax In range_data
If datax.Interior.ColorIndex = xcolor Then
CountCcolor = CountCcolor + 1
End If
Next datax
End Function
Bookmarks