Results 1 to 3 of 3

Thread: AutoFilter (XP)

  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AutoFilter (XP)

    When applying filters, is there a way to determine via code that no records were displayed?

    Thanks,
    John

  2. #2
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoFilter (XP)

    I found this on the web. Posting by Tom Ogilvy


    Sub CountVisRows()
    'by Tom Ogilvy
    Dim rng As Range
    Set rng = ActiveSheet.AutoFilter.Range

    MsgBox rng.Columns(1). _
    SpecialCells(xlCellTypeVisible).Count - 1 _
    & " of " & rng _
    .Rows.Count - 1 & " Records"

    End Sub


    Regards,
    John

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: AutoFilter (XP)

    You can also use the SUBTOTAL function to count the items. For example:.

    =SUBTOTAL(3,A2:A100)

    [The "3" is for the "COUNTA" function)

    Steve

Posting Permissions

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