PDA

View Full Version : When there is an advanced filter, clear it.



uktous
06-29-2012, 06:53 PM
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

jolivanes
06-29-2012, 09:00 PM
I am not familiar with Advanced Filters but this might do it.
From:
http://spreadsheetpage.com/index.php/site/tip/clearing_the_advanced_filter_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

mikerickson
06-29-2012, 09:14 PM
Perhaps

With ActiveSheet
If .FilterMode And Not .AutoFilterMode Then
.ShowAllData
End If
End With

Bob Phillips
06-30-2012, 01:46 AM
As it hides rows, why not just use

Activesheet.UsedRange.Rows.Hidden = False

yaseensallam
06-18-2018, 04:03 AM
Perhaps

With ActiveSheet
If .FilterMode And Not .AutoFilterMode Then
.ShowAllData
End If
End With

pmyk
10-31-2019, 12:19 AM
xld (http://www.vbaexpress.com/forum/member.php?2139-xld)
http://www.vbaexpress.com/forum/images/statusicon/user-offline.png
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.

Bob Phillips
11-07-2019, 04:10 PM
Good to see that you got help from an old post, and good to see someone who knows how to search for previous answers :winking2: