Filter object (Excel)

Represents a filter for a single column.

Remarks

The Filter object is a member of the Filters collection. The Filters collection contains all the filters in an autofiltered range.

Example

Use Filters (index), where index is the filter title or index number, to return a single Filter object. The following example sets a variable to the value of the On property of the filter for the first column in the filtered range on the Crew worksheet.

Set w = Worksheets("Crew") 
If w.AutoFilterMode Then 
 filterIsOn = w.AutoFilter.Filters(1).On 
End If

Note that all the properties of the Filter object are read-only. To set these properties, apply autofiltering manually or use the AutoFilter method of the Range object, as shown in the following example.

Set w = Worksheets("Crew") 
w.Cells.AutoFilter field:=2, Criteria1:="Crucial", _ 
 Operator:=xlOr, Criteria2:="Important"

Properties

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.