Sub comparer()
Set dico1 = CreateObject("scripting.dictionary")
Set dico2 = CreateObject("scripting.dictionary")
Dim tablo1() As Variant
Dim tablo2() As Variant
With ActiveSheet
fin1 = .Range("A" & .Rows.Count).End(xlUp).Row 'dernière ligne de la colonne A
fin2 = .Range("T" & .Rows.Count).End(xlUp).Row 'dernière ligne de la colonne T
tablo1 = .Range("A2:A" & fin1).Value 'on met la colonne A dans le tablo1
tablo2 = .Range("T2:T" & fin2).Value 'on met la colonne T dans le tablo2
End With
For i = LBound(tablo1, 1) To UBound(tablo1, 1) 'tous les éléments du tablo1 sont mis dans un dictionaire (sans doublon)
If Not dico1.exists(tablo1(i, 1)) Then
dico1.Add tablo1(i, 1), i
End If
Next i
For i = LBound(tablo2, 1) To UBound(tablo2, 1) 'tous les éléments du tablo2 sont mis dans un dictionaire (sans doublon)
If Not dico2.exists(tablo2(i, 1)) Then
dico2.Add tablo2(i, 1), i
End If
Next i
For Each c In dico1.keys 'pour chaque élément du dico1
If dico2.exists(c) Then 's'il existe aussi dans dico 2 ==> il s'agit d'un "resté"
Range("V" & Rows.Count).End(xlUp).Offset(1, 0) = c
Else
Range("W" & Rows.Count).End(xlUp).Offset(1, 0) = c 'sinon, il s'agit d'un supprimé
End If
Next c
For Each c In dico2.keys 'pour chaque élément du dico2
If Not dico1.exists(c) Then 's'il n'était pas dans dico1 ==> il s'agit d'un nouveau
Range("X" & Rows.Count).End(xlUp).Offset(1, 0) = c
End If
Next c
End Sub