Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Showing all in Filter


Apologies in advance because I know this is probably quite basic stuff
here...

I want to get a macro that releases all filters in all worksheets, but
I don't know how to get around the fact that a filter might not be
showing or set up for a particular sheet.

I'd appreciate any help to construct the necessary statement to get
around this.

thanks

tt


--
Timmy Mac1
------------------------------------------------------------------------
Timmy Mac1's Profile: http://www.excelforum.com/member.php...o&userid=15188
View this thread: http://www.excelforum.com/showthread...hreadid=514843

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Showing all in Filter

Each worksheet has two properties that will be of use here- FilterMode and
AutoFilterMode. The first of these indicates whether any rows are hidden by a
filter (either AutoFilter or Advanced Filter), the second indicates whether
the AutoFilter mode is active for a sheet, but will still = TRUE if all rows
are visible (i.e. AutoFilterMode only indicates whether the AutoFilter
dropdowns are visible on a worksheet). Note also that FilterMode is read
only, whereas AutoFilterMode is read/write (and can therefore be used to turn
off autofilter mode).

There is also a handy worksheet method ShowAllData, which will make all rows
visible, but will not remove the AutoFilter dropdowns. This method will raise
an error if there are no hidden rows.

Put all this together and you get something like this:
Sub RemoveAllFilters()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
If ws.FilterMode Then
ws.ShowAllData
End If
ws.AutoFilterMode = False
Next ws
End Sub

Cheers
Dave


"Timmy Mac1" wrote:


Apologies in advance because I know this is probably quite basic stuff
here...

I want to get a macro that releases all filters in all worksheets, but
I don't know how to get around the fact that a filter might not be
showing or set up for a particular sheet.

I'd appreciate any help to construct the necessary statement to get
around this.

thanks

tt


--
Timmy Mac1
------------------------------------------------------------------------
Timmy Mac1's Profile: http://www.excelforum.com/member.php...o&userid=15188
View this thread: http://www.excelforum.com/showthread...hreadid=514843


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Showing all in Filter

Sub bbb()
For Each sh In Worksheets
If sh.FilterMode Then
sh.ShowAllData
End If
Next
End Sub

is possibly what you want.

--
Regards,
Tom Ogilvy


"Timmy Mac1" wrote
in message ...

Apologies in advance because I know this is probably quite basic stuff
here...

I want to get a macro that releases all filters in all worksheets, but
I don't know how to get around the fact that a filter might not be
showing or set up for a particular sheet.

I'd appreciate any help to construct the necessary statement to get
around this.

thanks

tt


--
Timmy Mac1
------------------------------------------------------------------------
Timmy Mac1's Profile:

http://www.excelforum.com/member.php...o&userid=15188
View this thread: http://www.excelforum.com/showthread...hreadid=514843



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Showing all in Filter


Tom, Dave

Many thanks for your helpful responses :)

cheers

t

--
Timmy Mac
-----------------------------------------------------------------------
Timmy Mac1's Profile: http://www.excelforum.com/member.php...fo&userid=1518
View this thread: http://www.excelforum.com/showthread.php?threadid=51484

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
Getpivotdata....showing filter Tami Excel Worksheet Functions 0 December 10th 09 09:22 PM
Filter not showing blanks option skelly1969 Excel Discussion (Misc queries) 6 October 22nd 08 06:39 PM
How can I only the cells showing by a filter? Ping New Users to Excel 1 December 19th 07 10:37 PM
Auto Filter not showing all data dcknie Excel Worksheet Functions 5 November 14th 07 12:14 AM
Showing criteria in custom filter Rob Excel Programming 2 August 6th 05 04:47 PM


All times are GMT +1. The time now is 05:33 AM.

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

About Us

"It's about Microsoft Excel"