MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Autofilter code


Posted by Paul Magruder on February 28, 2001 11:30 AM

Is there code that maks sure the autofilters are off?
I know
Selection.Autofilter ...turns them on, and the next time... Selection.Autofilter ...turns them off, but
I need to make sure the filters are off when exiting a worksheet no matter if they were left on or off by the previous person that used the database.

Thanks in advance
Paul Magruder


Posted by Marcie on February 28, 2001 11:42 AM

This works for me:

If Worksheets("Sheet1").AutoFilterMode = True Then
Selection.AutoFilter ' to turn it off
End If

Posted by Paul Magruder on February 28, 2001 11:55 AM

Just what I needed.... Thanks

Paul