ah oui pardon, je n'ai pas mis le bon fichier
voici:
Petite question,
J'ai une colonne en plus ajouter, ou je modifie le code ?
J'ai ajouté la colonne D, mais après ?! .... je ne sais pas
Sub compare()
Dim Dico1 As New dictionary ' CreateObject("Scripting.Dictionary")
Dim Dico2 As New dictionary ' CreateObject("Scripting.Dictionary")
With Sheets("Feuil1")
fin = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 2 To fin
clé = .Range("A" & i) & "-" & .Range("B" & i) & "-" & .Range("C" & i)
& "-" & .Range("D" & i)
If Not Dico1.Exists(clé) Then
Dico1.Add clé, i
End If
Next i
End With
With Sheets("Feuil2")
fin = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 2 To fin
clé = .Range("A" & i) & "-" & .Range("B" & i) & "-" & .Range("C" & i)
& "-" & .Range("D" & i)
If Not Dico2.Exists(clé) Then
Dico2.Add clé, i
End If
Next i
End With
With Sheets("Feuil3")
' MsgBox Dico1.Count
' MsgBox Dico2.Count
For Each clé In Dico1.keys
If Not clé = "" Then
If Not Dico2.Exists(clé) Then
.Range("A" & .Rows.Count).End(xlUp).Offset(1, 0).Resize(1, 3) = Split(clé, "-")
End If
End If
Next clé
For Each clé In Dico2.keys
If Not clé = "" Then
If Not Dico1.Exists(clé) Then
.Range("A" & .Rows.Count).End(xlUp).Offset(1, 0).Resize(1, 3) = Split(clé, "-")
End If
End If
Next clé
End With
Set Dico1 = Nothing
Set Dico2 = Nothing
End Sub