removing duplicate entries

A

armagan

hi,

I'm trying to remove duplicate entries from a list of names
addresses.

what I'm after is some VBA code which will examine row by row the 'pos
code' field and the 'Full name' field and highlight/delete duplicat
entries.

its best illustrated by an example

FULL NAME ADDRESS
POSTCOD
Mr C. Verougstraete 6 somone st, Leicester HY8 9YK
Mrs R. Brazier 8 high st
HY9 9LK
Mr C. Verougstraete 6 somone st, HY
9YK

the last record is obviously a duplicate of row 2 therefore will b
removed

any help greatly appreciated

thank
 
B

Bob Phillips

Sub ClearData()
Dim iLastRow As Long
Dim i As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 1 Step -1
If Application.CountIf(Columns(1), Cells(i, "A").Value) > 1 Then
Rows(i).Delete
End If
Next i
End Sub


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 

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