Hi all,
I’m trying to count a certain color in multiple ranges, it works this function works fine from the worksheet, with one range, but when I try to add ranges to it, it doesnt’ work……anyone?
CBC((InRange As Range, WhatColorIndex As Integer, Optional strsht As String, Optional OfText As Boolean = False) As Long
Dim Rng As Range
Application.Volatile True
For Each Rng In InRange.Cells
If OfText = True Then
CBC = CBC – (Rng.Font.ColorIndex = WhatColorIndex)
Else
CBC = CBC – (Rng.Interior.ColorIndex = WhatColorIndex)
End If
Next Rng
End Function