Here's a macro that will count the number of cells in range E1:E10 that have the "greater than 5" condition for conditional formatting:
Sub CountConditionals()
Dim i As Integer
Dim intCells As Integer
Dim strFormat As String
For i = 1 To 10
On Error Resume Next
With Range("E" & i).FormatConditions(1)
'An error is generated if there is no conditional formatting, so see if an error occurs:
If IsError(.Operator > 0) Then
'do nothing
ElseIf .Operator = xlGreater And .Formula1 = "5" Then
intCells = intCells + 1
End If
End With
Next i
MsgBox "There are " & intCells & " cells with the '> 5' conditional format."
End Sub
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).