+ Reply to Thread
Results 1 to 2 of 2

Code For Count on Conditional formatting

  1. #1
    Aaron
    Guest

    Code For Count on Conditional formatting

    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

  2. #2
    Trevor Shuttleworth
    Guest

    Re: 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" <Aaron@discussions.microsoft.com> wrote in message
    news:CE28FC0A-47E4-4012-A2F7-974073124102@microsoft.com...
    > 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




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1