Range.RemoveDuplicates Method
Removes duplicate values from a range of values.
Version Information
Version Added: Excel
Syntax
expression.RemoveDuplicates(Columns, Header)
expression A variable that represents a Range object.
Parameters
| Name | Required/Optional | Data Type | Description |
|---|---|---|---|
| Columns | Optional | Variant | Array of indexes of the columns that contain the duplicate information. If nothing is passed then it assumes all columns contain duplicate information. |
| Header | Optional | XlYesNoGuess | Specifies whether the first row contains header information. xlNo is the default value; specify xlGuess if you want Excel to attempt to determine the header. |
Example
The following code sample removes duplicates with all columns from a range.
| Visual Basic for Applications |
|---|
|
The following code sample removes duplicates with the first 2 columns
| Visual Basic for Applications |
|---|
|