LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Find duplicate records and delete

Tom,
Works like a charm. Thank you so much!
Lupe

"Tom Ogilvy" wrote:

Sub FixDuplicateRows()
Dim RowNdx As Long
Dim ColNum As Integer
Dim rng as Range
ColNum = Selection(1).Column
For RowNdx = Selection(Selection.Cells.Count).Row To _
Selection(1).Row + 1 Step -1
If Cells(RowNdx, ColNum).Value = Cells(RowNdx - 1, ColNum).Value Then
if rng is nothing then
set rng = Cells(RowNdx,ColNum)
else
set rng = Union(rng,cells(RowNdx,ColNum)
end if
End If
Next RowNdx
if not rng is nothing then
rng.entirerow.Delete
End if
End Sub

--
Regards,
Tom Ogilvy


"Lupe" wrote:

The code is like this:
Sub FixDuplicateRows()
Dim RowNdx As Long
Dim ColNum As Integer
ColNum = Selection(1).Column
For RowNdx = Selection(Selection.Cells.Count).Row To _
Selection(1).Row + 1 Step -1
If Cells(RowNdx, ColNum).Value = Cells(RowNdx - 1, ColNum).Value Then
Cells(RowNdx, ColNum).Value = "----"
End If
Next RowNdx
End Sub



"Tom Ogilvy" wrote:

show the code that marks the duplicates and someone can modify it to delete.

--
Regards,
Tom Ogilvy


"Lupe" wrote:

Hi,
I have a list with children and the name of the parents. I need to send
letters to the parents but when there is more than one child per parent, the
parent's name appears more than once. I have used Ron de Bruin's code to
replace the duplicate entries with a character. It works just fine, but in
my case I want to delete the duplicate records at once. How can I do this?
Thanks, Lupe

 
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 records when certain records have duplicate column data JVroom New Users to Excel 1 January 26th 09 06:23 PM
Compare and delete duplicate records charles Excel Worksheet Functions 3 June 17th 08 11:46 AM
Delete Duplicate records Finger Tips Excel Worksheet Functions 2 April 29th 07 08:42 PM
how to delete duplicate records in a row Christian Setting up and Configuration of Excel 2 July 21st 06 01:39 AM
Delete Duplicate Records Jamie Collins Excel Programming 0 July 13th 04 12:34 PM


All times are GMT +1. The time now is 01:39 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"