Sub comp2()
Dim tabD1() As Variant
Dim tabD2() As Variant
With Sheets("Test")
fin = .Range("A" & .Rows.Count).End(xlUp).Row
tabD1 = .Range("A2:A" & fin).Value
fin = .Range("B" & .Rows.Count).End(xlUp).Row
tabD2 = .Range("B2:B" & fin).Value
For i = LBound(tabD1, 1) To UBound(tabD1, 1)
AinB = False
For j = LBound(tabD2, 1) To UBound(tabD2, 1)
If tabD1(i, 1) = tabD2(j, 1) Then
AinB = True
Exit For
End If
Next j
If AinB Then
.Range("D" & .Rows.Count).End(xlUp).Offset(1, 0) = tabD1(i, 1)
Else
.Range("F" & .Rows.Count).End(xlUp).Offset(1, 0) = tabD1(i, 1)
End If
Next i
For i = LBound(tabD2, 1) To UBound(tabD2, 1)
BinA = False
For j = LBound(tabD1, 1) To UBound(tabD1, 1)
If tabD2(i, 1) = tabD1(j, 1) Then
BinA = True
Exit For
End If
Next j
If BinA Then
'.Range("D" & .Rows.Count).End(xlUp).Offset(1, 0) = tabD1(i, 1) 'cas déjà traité avec la boucle précédente
Else
.Range("E" & .Rows.Count).End(xlUp).Offset(1, 0) = tabD2(i, 1)
End If
Next i
End With
End Sub