AdvancedFilter property?

  • Thread starter Thread starter Ted M H
  • Start date Start date
T

Ted M H

I need a way to clear any and all AdvancedFilter on a worksheet so that all
rows are displayed. I've tried the ShowAllData method and it works fine as
long as there are filtered rows on the sheet. But the method fails if there
are no filtered rows.

Is there a way ShowAllData regardless of whether rows are filtered? If not,
is there a way to check for AdvancedFilter--a sort of AdvancedFilter property?

Many thanks.
 
Hi
Just suppress the error

On Error Resume Next 'required if Advanced filter used
.ShowAllData
On Error GoTo 0
.AutoFilterMode = False 'Removes drop down arrows

regards
Paul
 
In a project long ago, I had problems with ShowAllData, which I worked around
like this:

On Error Resume Next
'Unhide all rows first.
ActiveSheet.ShowAllData
'In case ShowAllData doesn't work, unhide all rows.
ActiveSheet.Cells.EntireRow.Hidden = False
On Error GoTo My_ErrorHandler

Hope this helps,

Hutch
 
Thanks for the information. The autofilter stuff is mostly irrelevant to my
question, which is about advanced filter.
 
Thanks a million for the quick replies. I ended up going with the on error
resume next option. I didn't realize that the worksheet.filtermode property
applied to either autofilter or advanced filter. Now I know.
Much obliged.
 
...If not, is there a way to check for AdvancedFilter...?

If you would have looked through the code samples at the link that Ryan
provided, I think you might have found the answer to the above question in
the "Turn On Excel AutoFilter" example.
 
Hi Rick,

I'm not sure what your point is, but I sure don't see the answer in these
code samples. The Turn on Excel AutoFilter example definitely does not
provide the answer. Again, my question was about Advanced Filter and the
AutoFilterMode property has nothing to do with Advanced Filter.

Thanks for your interest, though.
 
You can use;

Sub RemoveFilters()
On Error Resume Next
Sheet1.ShowAllData
On Error GoTo 0
End Sub
 
Please accept my profuse apology... I read your reference to "Advanced
Filter" and my mind's eye saw "AutoFilter". I had just been doing some stuff
with AutoFilter which, I guess, conditioned me to think "Auto" when I saw
the word "Advanced"... very strange.
 
Back
Top