View Full Version : Solved: find duplicate entries in colunms

06-16-2008, 01:01 AM
Hi all,

Hope you can help with this one.
I found lots of macros that will find duplicate entries in a single column and compare rows and then delete the duplicated, but can someone give me an example of how you would go about doing the same with multiple columns.

i've attached an example worksheet in case i haven't explained myself well.


06-16-2008, 02:00 AM
ARe you sure it is just those, looks more to me

Sub ClearDuplicates()
Dim col As Range
Dim cell As Range
Dim LastRow As Long
Dim LastCol As Long

With Range("C1")

LastRow = .CurrentRegion(.CurrentRegion.Count).Row
LastCol = .CurrentRegion(.CurrentRegion.Count).Column

For Each col In Columns("C").Resize(, LastCol).Columns

For Each cell In col.Cells(1, 1).Resize(LastRow)

If Application.CountIf(Columns(2).Resize(, cell.Column - 2), cell.Value) > 0 Then

End If
Next cell
Next col
End With
End Sub

06-16-2008, 04:28 AM
thanks XLD, that worked great.

and you were right there were more. to many numbers !!

thanks again.