Forum Discussion
Deleted
Jul 17, 2019Counting cells based on their colors given from conditional formatting
I have multiple file sheets that contain multiple conditional formatting rules based from formulas. Each row is completely highlighted and I want to count the number of rows that are highlighted in a...
Berndvbatanker
Jul 17, 2019Iron Contributor
Deleted
Hi Jacob,
the following macro counts all weekends in selection. Here the colorindex is 43. See attachment, too.
Sub ReadColor()
Dim rngcell As Range
Dim i As Integer
For Each rngcell In Selection
If rngcell.DisplayFormat.Interior.ColorIndex = 43 Then
i = i + 1
End If
Next rngcell
MsgBox i
End Sub
Best regards
Bernd
http://https:\\www.vba-Tanker.com