Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Clear autofilters?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rishi  Dhupar - 25 Jan 2006 17:22 GMT
Hi,

I am filtering my data, based on user input.  But I need a way to reset
the filters, here is some example code.  Say I filter by one, then
reset the data by using Spreadsheet1.ActiveSheet.ShowAllData  then they
try to filter by "2".  Problem is that it includes "1" and "2".  How
can I fix this?

Thanks

   With Me.Spreadsheet1.ActiveWorkbook.ActiveSheet
       Set owcAutoFilter = .autoFilter
       With owcAutoFilter
           With .Filters(1).Criteria
               .FilterFunction = ssFilterFunctionInclude
               .Add "1"
           End With
       .Apply
       End With
       Set owcAutoFilter = Nothing
   End With
Rishi  Dhupar - 25 Jan 2006 17:24 GMT
Just to add to this, I tried to shut the autofilter off and then on
again to clear the filter doesn't seem to work.  Using this code

'OFF
Me.Spreadsheet1.ActiveSheet.AutoFilterMode = False
'ON
Me.Spreadsheet1.ActiveSheet.UsedRange.autoFilter
Crowbar - 25 Jan 2006 17:34 GMT
If you just want to reset one filter: -

Selection.AutoFilter Field:=1

you will have to change the field number as appropiate
Rishi  Dhupar - 25 Jan 2006 17:34 GMT
Errr... love it when I figure it out after I post.  I was saving my
input in an array and wasn't resetting it.

thanks have a nice day.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.