+ Reply to Thread
Results 1 to 2 of 2

Count displayed rows

  1. #1
    GDCross
    Guest

    Count displayed rows

    I am trying to run this code in Excel 2k so that I can count the number of
    displayed rows when I display only Subtotal totals. Unfortunately, I get a
    run-time error 91
    "Object variable or With block variable not set". With so little code, I can
    believe this is not working? Desperately seeking wisdom :{

    Dim rng as Range
    set rng = ActiveSheet.Autofilter.Range.Columns(1).specialCells(xlVisible)
    msgbox rng.Count - 1 & " data rows are visible"


  2. #2
    Dave Peterson
    Guest

    Re: Count displayed rows

    Same response as Tuesday:


    You haven't applied data|filter|autofilter to your worksheet -- look for those
    dropdown arrows and you'll see that they aren't there.



    GDCross wrote:
    >
    > I am trying to run this code in Excel 2k so that I can count the number of
    > displayed rows when I display only Subtotal totals. Unfortunately, I get a
    > run-time error 91
    > "Object variable or With block variable not set". With so little code, I can
    > believe this is not working? Desperately seeking wisdom :{
    >
    > Dim rng as Range
    > set rng = ActiveSheet.Autofilter.Range.Columns(1).specialCells(xlVisible)
    > msgbox rng.Count - 1 & " data rows are visible"


    --

    Dave Peterson

+ 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