Hello,
I am using Windows 7... Excel 2010.
I am looking for a more efficient way to Delete Duplicate Values, in cells, in specified columns.
I do not want to delete the rows in which the duplicates appear. Just keep the first instance of the value, and delete the others.
I have been using this:
[vba]
Sub DeleteDups()
Dim lastRow As Long, i As Long
Application.ScreenUpdating = False
With Sheets("Data")
lastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For i = lastRow To 1 Step -1
If Application.CountIf(.Range("C1:C" & lastRow), .Range("C" & i)) > 1 Then
.Range("C" & i).ClearContents
End If
Next i
End With
Application.Screenupdating = True
End Sub
[/vba]
And adding other columns to it as needed.
But the data can be 15 or 20 K rows, and over multiple columns, it is slow. It does work though. Data keeps growing too.
Attached is a sample.
Many thanks In advance.
C.R.