Syntax

expression.AdvancedFilter(Action, CriteriaRange, CopyToRange, Unique)

expression A variable that represents a Range object.

Parameters

Name Required/Optional Data Type Description
Action Required One of the constants of XlFilterAction specifying whether to make a copy or filter the list in place.
CriteriaRange Optional Variant The criteria range. If this argument is omitted, there are no criteria.
CopyToRange Optional Variant The destination range for the copied rows if Action is xlFilterCopy. Otherwise, this argument is ignored.
Unique Optional Variant True to filter unique records only. False to filter all records that meet the criteria. The default value is False.

Return Value
Variant

Example

This example filters a database (named "Database") based on a criteria range named "Criteria."

Visual Basic for Applications
Range("Database").AdvancedFilter _ Action:=xlFilterInPlace, _ CriteriaRange:=Range("Criteria")
advanced advanced filter Advanced Filter Method AdvancedFilter AdvancedFilter method Apply filter criteria to selected row? Change the values in a table based on certain value? Copy only unique values from table? Filter for unique values? Filter list?

See also: