Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Jordon Willis   on Sep 21 In MS Office Category.

  
Question Answered By: Muntasir Bashara   on Sep 21

You can control autofilters from VBA. For instance, these two lines from
one of my spreadsheets:

Call Selection.AutoFilter(Field:=4, Criteria1:="<=30-Jun-2006")
Call Selection.AutoFilter(Field:=10, Criteria1:="=")

These set a date filter  on column 4 and an "empty" filter on column 10.

The following clears any filters (i.e. "show all")

With ActiveSheet
If .FilterMode Then
Call .ShowAllData
End If
End With

Note that I don't explicitly define a Selection for the AutoFilter - as long
as the correct sheet is current it seems to work  OK. AutoFilter needs to
have been associated with the relevant columns first, of course.

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Filter using VBA Or get search suggestion and latest updates.


Tagged: