March 10, 2016
Hi,
In the attached file there is a VBA code that gives me a function that counts by color.
The problem is that it doesn't work with conditional formatting
In the table the yellow cells were created from conditional design
And in the sample cell on this side is normal coloring
what can we do??
How do you count the yellow cells in data based on conditional formatting?
Thank you!
Leah
Moderators
January 31, 2022
Trusted Members
October 17, 2018
Hi Riny, I disagree, it is possible
Function countRowsWithConditionalColor(data_range As Range, cell_color As Range) As Long
Dim cntRes As Long, cel As Range
For Each cel In data_range
On Error Resume Next
If cel.DisplayFormat.Interior.Color = cell_color.Interior.Color Then
cntRes = cntRes + 1
End If
Next cel
Err.Clear
On Error GoTo 0
countRowsWithConditionalColor = cntRes
End Function
Attached a copy of the (working) file
Trusted Members
Moderators
November 1, 2018
1 Guest(s)