Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Switching autofilter off using code

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    England
    Posts
    212
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Using code how can i firstly check to see if the autofilter is on and then if the filter is on, switch off so all records are showing.

    hope someone can help

    thanks

    Matt

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Posts
    363
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try this:

    Sub FilterOff()
    On Error Resume Next
    ActiveSheet.ShowAllData
    If Err.Description = "ShowAllData method of Worksheet class failed" Then
    Selection.AutoFilter
    endif
    End Sub



    It's never too late to learn something new.

    Ricky

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    England
    Posts
    212
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Cheers Ricky

  4. #4
    Board Regular
    Join Date
    May 2002
    Posts
    63
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Here's another way...

    If Sheets("Sheet1").FilterMode = True Then _
    Sheets("Sheet1").ShowAllData

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    England
    Posts
    212
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Cheers

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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