Sub Doublons()
Dim derlig&, i&, rgcol As Range, xrg As Range
Application.ScreenUpdating = False
Range("an:ao").Clear
derlig = Cells(Rows.Count, "a").End(xlUp).Row
i = Cells(Rows.Count, "e").End(xlUp).Row
If i > derlig Then derlig = i
i = Cells(Rows.Count, "am").End(xlUp).Row
If i > derlig Then derlig = i
Set rgcol = Range("am2:am" & derlig)
rgcol.Offset(, 1).FormulaR1C1 = "=ROW()"
rgcol.Offset(, 1).Value = rgcol.Offset(, 1).Value
With Range("a1:an" & derlig)
.Sort key1:=Range("a1"), order1:=xlAscending, _
key2:=Range("e1"), order2:=xlAscending, _
key3:=Range("am1"), order3:=xlAscending, _
Header:=xlYes
End With
rgcol.Offset(, 2).FormulaR1C1 = "=(RC[-40]=R[-1]C[-40])*(RC[-36]=R[-1]C[-36])*(RC[-2]=R[-1]C[-2])+(RC[-40]=R[1]C[-40])*(RC[-36]=R[1]C[-36])*(RC[-2]=R[1]C[-2])"
rgcol.Offset(, 2).Value = rgcol.Offset(, 2).Value
With Range("a1:ao" & derlig)
.Sort key1:=Range("ao1"), order1:=xlAscending, _
Header:=xlYes
End With
On Error Resume Next
i = 0
Set xrg = Range("ao:ao").Find(what:=1, lookat:=xlWhole, LookIn:=xlValues)
On Error GoTo 0
Range("a:am").Interior.ColorIndex = xlColorIndexNone
If Not xrg Is Nothing Then
i = xrg.Row
Range(Cells(xrg.Row, "a"), Cells(derlig, "am")).Interior.Color = RGB(255, 255, 0)
End If
With Range("a1:an" & derlig)
.Sort key1:=Range("an1"), order1:=xlAscending, _
Header:=xlYes
End With
Range("an:ao").Clear
Range("a1:am1").Interior.Color = RGB(200, 200, 200)
If i > 0 Then i = derlig - i + 1
MsgBox i & " doublon(s)"
End Sub