Consulting

Results 1 to 7 of 7

Thread: When there is an advanced filter, clear it.

  1. #1

    When there is an advanced filter, clear it.

    Hi,

    Could you please show me a macro which can perform the following function without using on error resume next?

    When there is an advanced filter, clear it.

    If there is no advanced filter then fine.

    Thanks

  2. #2
    I am not familiar with Advanced Filters but this might do it.
    From:
    http://spreadsheetpage.com/index.php...er_dialog_box/

    Sub ShowAdvancedFilterDialog()
    '   Delete names
        On Error Resume Next
        With ActiveWorkbook
          .Names("_FilterDatabase").Delete
          .Names("Criteria").Delete
          .Names("Extract").Delete
        End With
        On Error GoTo 0
    '   Display the dialog box
        Application.Dialogs(xlDialogFilterAdvanced).Show
    End Sub

  3. #3
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Perhaps

    [VBA]With ActiveSheet
    If .FilterMode And Not .AutoFilterMode Then
    .ShowAllData
    End If
    End With
    [/VBA]

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    As it hides rows, why not just use

    [VBA]Activesheet.UsedRange.Rows.Hidden = False[/VBA]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5

    thanks

    Quote Originally Posted by mikerickson View Post
    Perhaps

    [VBA]With ActiveSheet
    If .FilterMode And Not .AutoFilterMode Then
    .ShowAllData
    End If
    End With
    [/VBA]

  6. #6
    VBAX Regular
    Joined
    Oct 2013
    Posts
    27
    Location
    xld

    I used Advancedfilter.
    Then I wanted to remove the filter.
    The following code showed some.
     Cells.AutoFilter
    But one row was hidden.
    I tried the code showalldata and still that row was hidden.
    Your code did the job and that hidden row became visible.
    Many Thanks.
    Last edited by pmyk; 10-31-2019 at 12:20 AM. Reason: To include Suggested persons name

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Good to see that you got help from an old post, and good to see someone who knows how to search for previous answers
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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