Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro for clearing autofilter
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro for clearing cells | Excel Discussion (Misc queries) | |||
Macro for clearing cell contents | Excel Discussion (Misc queries) | |||
Clearing All check boxes using Macro | Excel Discussion (Misc queries) | |||
Macro - Cell clearing | Excel Programming | |||
macro clearing cell content | Excel Programming |