Remove Duplicates

M

Michelle

I have the following code and need to some how chang it so that it will look
at two rows and remove duplicates based on that...
Say I have
Jim Smith 7-1-07
Jim Smith 7-1-07
Jim Smith 7-1-07
Jim Smith 7-2-07
Jim Smith 7-2-07
Donna Smith 7-2-07
Donna Smith 7-2-07

what I would need is for the code to look at the name and find the dup's
delete them only if the name and the date are dupes for a spread sheet with
about 1700 entries.

here is my current code.

With Cells

Set rng = .Range(.Cells(1, 1), .Cells(1, 1).End(xlDown))
rng.Select
End With

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).EntireRow.Delete shift:=xlUp
End If
Next RowNdx
 
M

Mark Fitzpatrick

I think you accidentally published this in the wrong newsgroup as it looks
like an Excel issue. This message was posted to the Microsoft FrontPage
newsgroup instead so you may want to re-post this into the Excel NG.
 
M

Michelle

I did move it to excel thanks

Mark Fitzpatrick said:
I think you accidentally published this in the wrong newsgroup as it looks
like an Excel issue. This message was posted to the Microsoft FrontPage
newsgroup instead so you may want to re-post this into the Excel NG.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top