Option Explicit
Sub test()
Dim a, e, i As Long, j As Long, w, x, y As Long, txt As String
a = Sheets("Feuil1").Range("a1").CurrentRegion.Value
With CreateObject("Scripting.Dictionary")
For i = 2 To UBound(a, 1)
'on determine les cles du dictionnaire
txt = Join$(Array(a(i, 1), a(i, 4)), Chr(2))
ReDim w(1 To 6)
For j = 1 To UBound(a, 2)
w(j) = a(i, j)
Next
w(6) = "Effacé"
.Item(txt) = w
Next
a = Sheets("Feuil2").Range("a1").CurrentRegion.Value
For i = 2 To UBound(a, 1)
txt = Join$(Array(a(i, 1), a(i, 4)), Chr(2))
If .exists(txt) Then
w = .Item(txt)
If w(2) <> a(i, 2) Or w(3) <> a(i, 3) Then
w(6) = "Changé"
Else
w(6) = Empty
End If
Else
ReDim w(1 To 6)
For j = 1 To UBound(a, 2)
w(j) = a(i, j)
Next
w(6) = "Nouveau"
End If
.Item(txt) = w
Next
For Each e In .keys
If IsEmpty(.Item(e)(6)) Then .Remove e
Next
x = .items: y = .Count
End With
Application.ScreenUpdating = False
On Error Resume Next
Application.DisplayAlerts = False
Sheets("Résultat").Delete
On Error GoTo 0
Sheets.Add(after:=Sheets(Sheets.Count)).Name = "Résultat"
With Sheets("Résultat").Cells(1)
.Resize(1, 6).Value = Array("A_TAG", "A_IOAD", "A_DESC", "A_IENAB", "A_PRI", "Statut")
.Offset(1).Resize(y, 6).Value = _
Application.Transpose(Application.Transpose(x))
With .CurrentRegion
.Font.Name = "calibri"
.Font.Size = 10
.VerticalAlignment = xlCenter
.BorderAround Weight:=xlThin
.Borders(xlInsideVertical).Weight = xlThin
With .Rows(1)
.BorderAround Weight:=xlThin
.Interior.ColorIndex = 38
End With
.Columns.AutoFit
End With
End With
Application.ScreenUpdating = True
End Sub