Turn AutoFilters Off

G

Guest

I have a worksheet that may or may not have the AutoFilters turned on. I need
to have the filters off before I run the macro I have written. How can I
incorporate this into my macro? Thanks!
 
G

Guest

if you mean having each filter set to show 'all' then something like this
might help

With Sheets("MySheet")
For i = 1 To Sheets("MySheet").UsedRange.Columns.count '- 1
.Rows(1).AutoFilter field:=i
Next i
End With

change the argument of .Rows() to match what row your filters are in
 
G

Guest

I actually mean the the drop-down arrows for the filters are on and I need
them to be off.
 
G

Guest

Right, this code should reset each of the drop-down auto-filters in .rows(X)
to display 'All' records in that row, thus turning them off.

Ie if column B contains month names (Jan, Feb, etc etc) and you had it set
to only show January, this code will reset the filter to show them all (ie
they're now off)
 
G

Guest

or did you mean you wanted to completely remove the autofilter? (so that the
drop-down boxes are no longer there)?
 
G

Guest

Yes. I need to completely remove the filters.

Gixxer_J_97 said:
or did you mean you wanted to completely remove the autofilter? (so that the
drop-down boxes are no longer there)?
 
T

Tom Ogilvy

Activesheet.AutoFilterMode = False

works whether there is an autofilter on the sheet or not.
 
G

Guest

Dave & Tom - would that reset them all to show 'all' items in the column, or
remove the autofilter from the sheet?

thx!

J
 

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