Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting duplicate names law Excel Discussion (Misc queries) 4 December 4th 07 10:52 PM
Deleting duplicate row RN Excel Discussion (Misc queries) 7 April 20th 07 09:05 AM
Deleting duplicate rows Kevin Excel Discussion (Misc queries) 1 May 2nd 06 12:16 AM
deleting duplicate names torbau Excel Discussion (Misc queries) 0 March 8th 06 04:59 PM
Deleting unused lines between used lines? Stevel Setting up and Configuration of Excel 1 November 25th 05 12:58 AM


All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"