Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro for clearing cells mocc Excel Discussion (Misc queries) 11 September 19th 09 10:43 PM
Macro for clearing cell contents Sal Excel Discussion (Misc queries) 6 January 9th 09 11:40 PM
Clearing All check boxes using Macro Anil Kumar N. Excel Discussion (Misc queries) 4 December 27th 07 10:40 AM
Macro - Cell clearing Paul H Excel Programming 11 January 7th 05 05:30 PM
macro clearing cell content Tyler[_2_] Excel Programming 2 November 19th 03 05:51 AM


All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"