AdvancedFilter property?

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.
 
P

Paul Robinson

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
 
T

Tom Hutchins

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
 
A

aflatoon

You can check the worksheet's FilterMode property - if it's True the
ShowAllData.

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

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

Many thanks.
 
T

Ted M H

Thanks for the information. The autofilter stuff is mostly irrelevant to my
question, which is about advanced filter.
 
T

Ted M H

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.
 
R

Rick Rothstein

...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.
 
T

Ted M H

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.
 
O

ozgrid.com

You can use;

Sub RemoveFilters()
On Error Resume Next
Sheet1.ShowAllData
On Error GoTo 0
End Sub
 
R

Rick Rothstein

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top