Criteria2 Property

Microsoft Excel Visual Basic

Criteria2 Property

       

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

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.

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