How to fill cell value with count of visible rows (Excel).

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scrapcode
    New Member
    • Apr 2010
    • 26

    How to fill cell value with count of visible rows (Excel).

    Hi guys, this should be an easy one.

    I have an Excel workbook that I need to run a filter with lots of criteria on a number of different sheets and count the results every day. I'm looking to automate it and I'm almost there. Using VBA i've got the filters to select the criteria I need but I can't get it to count the rows that are visible. the code I've tried so far looks like this:

    Code:
    cells.Range("B2").Value = SpecialCells(xlCellTypeVisible.count
    I hope you can see my logic from that. It's also important that the values stay fixed after the count. What I mean is because of the number of filters I need to run I only want to do it once. So the one macro would run like:

    filter
    count
    dump value in cell
    filter
    count
    dump value in other cell
    e.t.c

    I'm sure its only the one line of code I'm missing.

    appreciate your help.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You don't need it. The visible/total row count will be on the status bar on the bottom left.

    Comment

    • scrapcode
      New Member
      • Apr 2010
      • 26

      #3
      Hi Rabbit, thanks for your reply. I know the count appears there but I need to do 12 different searches each with 4/5 criteria every day. I know that if I can get my code working then one macro will deliver all the results in one go. So it would go something like:

      Filter
      count
      dump result in cell

      filter
      count
      dump new result in different cell

      etc.

      Then the macro will be generating a mini report for me.

      Comment

      Working...