How To Count Cells By Colors With Conditional Formatting In Excel || How To Count Coloured Cells
Watch this video to understand how to How To Count Cells By Colors With Conditional Formatting In Excel
VBA code:
Button:
Private Sub Refresh_Click()
'Team 1
Call CountColorCellsAQ3
End Sub
Private Sub CountColorCellsAQ3()
'Variable declaration
Dim rng As Range
Dim lColorCounter As Long
Dim rngCell As Range
'Set the range of cells to count
Set rng = Sheet2.Range("U3:AL3")
'loop throught each cell in the range
For Each rngCell In rng
'Checking Red color
If Cells(rngCell.Row, rngCell.Column).DisplayFormat.Interior.Color = RGB(255, 153, 153) Then
lColorCounter = lColorCounter + 1
End If
Next
'Display the total number of red cells in cell listed below
Sheet2.Range("AQ3") = lColorCounter
End Sub
--------------------------------
If you would like to subscribe to see what other things I think could be useful please visit my channel - / @johnmclaughlin5706
16 сен 2019