NamedRange::AdvancedFilter Method (XlFilterAction, Object^, Object^, Object^)
Filters or copies data from a list based on a criteria range.
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Object^ AdvancedFilter( XlFilterAction Action, Object^ CriteriaRange, Object^ CopyToRange, Object^ Unique )
Parameters
- Action
-
Type:
Microsoft.Office.Interop.Excel::XlFilterAction
Can be one of the following XlFilterAction values:
- CriteriaRange
-
Type:
System::Object^
The criteria range. If this argument is omitted, there are no criteria.
- CopyToRange
-
Type:
System::Object^
The destination range for the copied rows if Action is xlFilterCopy. Otherwise, this argument is ignored.
- Unique
-
Type:
System::Object^
true to filter unique records only; false to filter all records that meet the criteria. The default value is false.
Return Value
Type: System::Object^If the initial selection is a single cell, that cell's current region is used.
For information on optional parameters, see Optional Parameters in Office Solutions.
The following code example sets integer values in the range of cells from A1 through A5 and then uses the AdvancedFilter method to filter and copy the values to the range of cells starting at B1.
This example is for a document-level customization.