Turn AutoFilters Off

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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
 
I actually mean the the drop-down arrows for the filters are on and I need
them to be off.
 
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)
 
or did you mean you wanted to completely remove the autofilter? (so that the
drop-down boxes are no longer there)?
 
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)?
 
Activesheet.AutoFilterMode = False

works whether there is an autofilter on the sheet or not.
 
Dave & Tom - would that reset them all to show 'all' items in the column, or
remove the autofilter from the sheet?

thx!

J
 
And if there isn't one, that will add one. Don't believe that is what he
wants.
 

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

Back
Top