Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default Macro to delete duplicate/triplicate rows

Is this a one-off. In which case insert a helper column in front of Col A say, and then assuming
your data is in what would now be Cols B/C/D/E, in cell A1 put = B1&C1&D1&E1. Copy it down to the
bottom, and then copy the column and paste special as values. You can now use Chip pearson's
macro to delete all rows with duplicate entries in Col A. Then when done, just delete Col A.

http://www.cpearson.com/excel/deleti...eDuplicateRows

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL2K & XLXP

----------------------------------------------------------------------------
Attitude - A little thing that makes a BIG difference
----------------------------------------------------------------------------



"Ashleigh K." wrote in message
...
Hello All,

I am working with a very large database of first/last names and job titles.
Many of the entries in the database are repeated (up to four entries of the
same name). I am trying to write a macro so that if the last name, first
name and job title fields match the cells in the row below, then delete that
row. I have had some success with the macro written below, however I run
into problems when there are more than two entries of the same name. Does
anyone have any ideas as to how I might rewrite this macro so that it will
delete all of the duplicates (triplicates, etc)?

Sub Delete Row ( )
For i = 1 To 29
If Cells(i, 1) = Cells(i + 1, 1) And Cells(i, 2) = Cells(i + 1, 2) And
Cells(i, 3) = Cells(i + 1, 3) Then
Cells(i + 1, 1).Rows.EntireRow.Delete

Thanks in advance for any help,

A.




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
delete duplicate rows christinaLO Excel Worksheet Functions 1 February 27th 07 06:22 PM
Delete Duplicate Rows Macro Question elfmajesty Excel Discussion (Misc queries) 1 June 17th 06 01:12 AM
Macro to delete duplicate/triplicate rows Tom Ogilvy Excel Programming 0 August 11th 03 05:47 PM
Delete duplicate rows christina Excel Programming 1 August 4th 03 01:04 PM
delete duplicate rows rhys Excel Programming 2 July 29th 03 12:52 PM


All times are GMT +1. The time now is 11:31 AM.

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

About Us

"It's about Microsoft Excel"