View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default macro for clearing autofilter

if Activesheet.AutoFilterMode then
if Activesheet.FilterMode then
Activesheet.ShowAllData
End if
End if

--
Regards,
Tom Ogilvy


"BorisS" wrote in message
...
I'm having a little trouble with part of a macro. Before running what I

need
to run, I need to make sure the autofiler is clear (not turned off, just
clear of selections). I have the command
Selection.AutoFilter Field:="X"

in there 20 times for all the columns that are filtered right now. But I
noticed that if it gets to a column which is not part of the filter set

and
tries to run this command on that column, it gives an error. Problem is

that
I want to ensure that if another column is added to the filter set, that
column, too, is included in the macro set. Is there any way to basically

say
"for all filtered columns on this sheet, clear out the filters" (again,
maintaining the filtering capability on all columns that have it, but just
setting the selections to "all" for each).

Thx.
--
Boris