Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default looking for autofilter with code


I am wanting to know if there is code that can look to see if any field
within autofilter are currently filtering. I would like to have cod
that is dependent on whether or not this is true.

I currently have to just tell every field to stop filtering even i
they're not and this takes a long time and needlessly a lot of th
time


Thank

--
lcorey
-----------------------------------------------------------------------
lcoreyl's Profile: http://www.excelforum.com/member.php...nfo&userid=204
View this thread: http://www.excelforum.com/showthread.php?threadid=26232

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default looking for autofilter with code


Following will rebuild the autofilter,all existing filters are cleared.
If you want to SET a new filter then add the arguments to the second
autofilter call


Sub ResetAutofilter(Optional wks As Worksheet,)
If wks Is Nothing Then Set wks = ActiveSheet
With wks
If .AutoFilterMode Then
With .AutoFilter.Range
.AutoFilter 'First call clears an existing autofilter.
.AutoFilter 'Sets an empty autofilter.
'.AutoFilter Field:=1,Criteria1:="a*"

End With
End If
End With
End Sub

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


lcoreyl wrote:


I am wanting to know if there is code that can look to see if any

fields
within autofilter are currently filtering. I would like to have code
that is dependent on whether or not this is true.

I currently have to just tell every field to stop filtering even if
they're not and this takes a long time and needlessly a lot of the
time


Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default looking for autofilter with code

to answer your specific Question:

Dim w as Worksheet, f as Filter
Set w = Activesheet
For Each f In w.AutoFilter.Filters
If f.On Then

End if
Next

Look at the object browser for the filter object to see properties.

--
Regards,
Tom Ogilvy


"lcoreyl" wrote in message
...

I am wanting to know if there is code that can look to see if any fields
within autofilter are currently filtering. I would like to have code
that is dependent on whether or not this is true.

I currently have to just tell every field to stop filtering even if
they're not and this takes a long time and needlessly a lot of the
time


Thanks


--
lcoreyl
------------------------------------------------------------------------
lcoreyl's Profile:

http://www.excelforum.com/member.php...fo&userid=2042
View this thread: http://www.excelforum.com/showthread...hreadid=262326



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
Excel vba autofilter code Isis[_2_] Excel Discussion (Misc queries) 0 April 26th 10 05:34 PM
Excel VBA AutoFilter code Isis[_2_] Excel Discussion (Misc queries) 0 April 26th 10 05:31 PM
vba code on autofilter ub Excel Discussion (Misc queries) 1 August 6th 08 08:09 PM
Autofilter code Dominic LeVasseur Excel Discussion (Misc queries) 2 August 16th 06 09:33 PM
Newbie : Autofilter thru code ? Rich[_16_] Excel Programming 2 October 5th 03 07:27 PM


All times are GMT +1. The time now is 02:09 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"