Apply Method Example

This example turns on the AutoFilter for the range A1:J22, sets filters for columns 1 and 3, and then applies the filters.

Spreadsheet1.Range("a1:j22").AutoFilter
Set af = Spreadsheet1.ActiveSheet.AutoFilter
Set filterColumnOne = af.Filters(1)
Set filterColumnThree = af.Filters(3)
filterColumnOne.Criteria.Add "blue"    ' Don't show blue in column 1.
filterColumnOne.Criteria.Add "green"    ' Don't show green in column 1.
filterColumnThree.Criteria.Add "yellow"    ' Don't show yellow in column 3.
af.Apply