Filters a list using the AutoFilter.
Note Apply the AutoFilter property to a Worksheet object to return an AutoFilter object.
Syntax
expression.AutoFilter(Field, Criteria1, Operator, Criteria2, VisibleDropDown)
expression Required. An expression that returns a Range object.
Field Optional Variant. The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field one).
Criteria1 Optional Variant. The criteria (a string; for example, "101"). Use "=" to find blank fields, or use "<>" to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is xlTop10Items, Criteria1 specifies the number of items (for example, "10").
Operator Optional Variant. Can be one of the following XlAutoFilterOperator constants: xlAnd, xlBottom10Items, xlBottom10Percent, xlOr, xlTop10Items, or xlTop10Percent. Use xlAnd and xlOr with Criteria1 and Criteria2 to construct compound criteria.
Criteria2 Optional Variant. The second criteria (a string). Used with Criteria1 and Operator to construct compound criteria.
VisibleDropDown Optional Variant. True to display the AutoFilter drop-down arrow for the filtered field. False to hide the AutoFilter drop-down arrow for the filtered field. True by default.
Remarks
If you omit all the arguments, this method simply toggles the display of the AutoFilter drop-down arrows in the specified range.