Filter.Criteria2 Property

Excel Developer Reference

Returns the second filtered value for the specified column in a filtered range. Read-only Variant.

Syntax

expression.Criteria2

expression   A variable that represents a Filter object.

Remarks

If you try to access the Criteria2 property for a filter that does not use two criteria, an error will occur. Check that the Operator property of a Filter object doesn’t equal zero (0) before trying to access the Criteria2 property.

Example

The following example sets a variable to the value of the Criteria2 property of the filter for the first column in the filtered range on the Crew worksheet.

Visual Basic for Applications
  With Worksheets("Crew")
    If .AutoFilterMode Then
        With .AutoFilter.Filters(1)
            If .On And .Operator Then
                c2 = .Criteria2
            Else
                c2 = "Not set"
            End If
        End With
    End If
End With

See Also