ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   looking for autofilter with code (https://www.excelbanter.com/excel-programming/310861-looking-autofilter-code.html)

lcoreyl[_12_]

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


keepITcool

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




Don Guillett[_4_]

looking for autofilter with code
 
This may helpWorksheets("Sheet1").ShowAllData-- Don GuillettSalesAid
"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




Tom Ogilvy

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





All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com