Range.AutoFilter(Object, Object, XlAutoFilterOperator, Object, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Filters a list using the AutoFilter.
public object AutoFilter (object Field, object Criteria1, Microsoft.Office.Interop.Excel.XlAutoFilterOperator Operator = Microsoft.Office.Interop.Excel.XlAutoFilterOperator.xlAnd, object Criteria2, object VisibleDropDown);
Public Function AutoFilter (Optional Field As Object, Optional Criteria1 As Object, Optional Operator As XlAutoFilterOperator = Microsoft.Office.Interop.Excel.XlAutoFilterOperator.xlAnd, Optional Criteria2 As Object, Optional VisibleDropDown As Object) As Object
Parameters
- Field
- Object
Optional Object. 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
- Object
Optional Object. 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
- XlAutoFilterOperator
Optional XlAutoFilterOperator. Can be one of the following XlAutoFilterOperator constants:xlAnddefault
xlBottom10ItemsxlBottom10PercentxlOrxlTop10ItemsxlTop10PercentUse xlAnd and xlOr with Criteria1
and Criteria2
to construct compound criteria.
- Criteria2
- Object
Optional Object. The second criteria (a string). Used with Criteria1 and Operator to construct compound criteria.
- VisibleDropDown
- Object
Optional Object. 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.
Returns
Remarks
Apply the AutoFilter property to a Worksheet object to return an AutoFilter object.
If you omit all the arguments, this method simply toggles the display of the AutoFilter drop-down arrows in the specified range.