I am trying to count the number of conditional formatted cells in a row.
This function however returns the total number of cells, even those that did not pass the conditional formatting criteria:
Public Function CountColour(pRange1 As Range, pRange2 As Range) As Double Application.Volatile Dim rng As Range For Each rng In pRange1 If rng.FormatConditions(1).Interior.Color = pRange2.FormatConditions(1).Interior.Color Then CountColour = CountColour + 1 End If Next End Function
It is a school test where the number of right answers needs to be calculated.
Skip trying to count the conitional formatting and count the condition: