View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default Code For Count on Conditional formatting

Aaron

Do you really need a macro ?

Why not just a COUNTIF ?

=COUNTIF(B:IV,"30") anywhere in column A

or

=COUNTIF(A2:A65536,"30")+COUNTIF(B:IV,"30") in cell A1

But, if you must:

Sub CountGT30_1()
MsgBox WorksheetFunction.CountIf(Range("A:IV"), "30")
End Sub

Sub CountGT30_2()
MsgBox WorksheetFunction.CountIf(Cells, "30")
End Sub

Sub CountGT30_3()
MsgBox WorksheetFunction.CountIf(Columns("A:IV"), "30")
End Sub

Sub CountGT30_4()
MsgBox WorksheetFunction.CountIf(Rows("1:65536"), "30")
End Sub

Regards

Trevor


"Aaron" wrote in message
...
Hello all,

I am looking to have code once a macro runs to be able the do a count on
the
conditional formatting the was triggered on a tab. So condition1 states
turn
red if the cell value is greater than 30. After a macro runs a msgbox
states
there are 33 counts of condition1 on sheet1 tab.

Thanks,
Aaron