xShaider / testingan

1 stars 0 forks source link

Count cell with color #9

Open xShaider opened 3 months ago

xShaider commented 3 months ago

Function CountCellsByColor(rng As Range, color As Long) As Long Dim cell As Range Dim count As Long count = 0

For Each cell In rng
    If cell.DisplayFormat.Interior.Color = color Then
        count = count + 1
    End If
Next cell

CountCellsByColor = count

End Function