Deleting duplicate lines
Sub DeleteDups()
Dim i as long
Dim rng as Range
set rng = Cells(rows.count,1).End(xlup)
for i = rng.row to 2 step -1
if cells(i,1).Value = cells(i-1,1).Value and _
cells(i,2).Value = cells(i-1,2).Value then
cells(i,1).EntireRow.Delete
End if
Next
Next
--
Regards,
Tom Ogilvy
Richard Leclezio wrote in message
...
What code must I write to delete duplicate rows in an
excel spreadsheet.
Eg:
Name Age
rich 25
rich 25
rich 25
linda 30
linda 30
linda 30
result:
rich 25
linda 30
|