Filter Object

There is a Filters collection associated with the AutoFilter object that holds a Filter object for each field in the AutoFilter. The On property of the Filter object indicates whether it is active. If it is active, you can discover the values of its properties. The following code returns the value "=Pradesh" after you have set the filter as shown in Figure 6-5, after converting the data to a table:

With ActiveSheet.ListObjects(l) If .ShowAutoFilter Then

With .AutoFilter.Filters(2) If .On Then

MsgBox .Criterial End If End With End If End With

The Filter object can only return the properties of a filter. You can't assign values to the properties. That can only be done using the AutoFilter method of the Range object.

0 0

Post a comment