Click to Rate and Give Feedback
MSDN
MSDN Library
Office Development
Excel 2007
Range Object
Methods
 RemoveDuplicates Method

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (0)
Range.RemoveDuplicates Method
Removes duplicate values from a range of values.

Version Information
 Version Added:  Excel 2007

Syntax

expression.RemoveDuplicates(Columns, Header)

expression   A variable that represents a Range object.

Parameters

NameRequired/OptionalData TypeDescription
ColumnsOptionalVariantArray of indexes of the columns that contain the duplicate information. If nothing is passed then it assumes all columns contain duplicate information.
HeaderOptionalXlYesNoGuessSpecifies 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
ActiveSheet.Range("A1:C100").RemoveDuplicates

The following code sample removes duplicates with the first 2 columns

Visual Basic for Applications
ActiveSheet.Range("A1:C100").RemoveDuplicates Columns:=Array(1,2), Header:=xlYes



Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker