looking for autofilter with code

  • Thread starter Thread starter lcoreyl
  • Start date Start date
L

lcoreyl

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
 
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 >
 
This may helpWorksheets("Sheet1").ShowAllData-- Don GuillettSalesAid
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top