title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
Range.AdvancedFilter method (Excel) |
vbaxl10.chm144078 |
|
|
fe1a19fc-ab0f-6149-25d9-6102d5789757 |
05/10/2019 |
medium |
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.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Action | Required | XlFilterAction | 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. |
Variant
This example filters a database named Database based on a criteria range named Criteria.
Range("Database").AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=Range("Criteria")
[!includeSupport and feedback]