This documentation is archived and is not being maintained.

Range.AdvancedFilter Method

Office 2007
Filters or copies data from a list based on a criteria range. If the initial selection is a single cell, that cell's current region is used.


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

expression   A variable that represents a Range object.


NameRequired/OptionalData TypeDescription
ActionRequiredXlFilterActionOne of the constants of XlFilterAction specifying whether to make a copy or filter the list in place.
CriteriaRangeOptionalVariantThe criteria range. If this argument is omitted, there are no criteria.
CopyToRangeOptionalVariantThe destination range for the copied rows if Action is xlFilterCopy. Otherwise, this argument is ignored.
UniqueOptionalVariantTrue to filter unique records only. False to filter all records that meet the criteria. The default value is False.

Return Value


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

Visual Basic for Applications
Range("Database").AdvancedFilter _
    Action:=xlFilterInPlace, _