Function Diff(tab1, tab2)
Set MonDico1 = CreateObject("Scripting.Dictionary")
For Each c In tab2: tmp = c: MonDico1(tmp) = "": Next c
Set mondico2 = CreateObject("Scripting.Dictionary")
For Each c In tab1
tmp = c
If Not MonDico1.Exists(tmp) Then mondico2(tmp) = ""
Next c
Dim d()
On Error Resume Next
tmp = Application.Caller.Rows.Count
If Err = 0 Then ReDim d(1 To Application.Caller.Rows.Count) Else ReDim d(1 To MonDico1.Count)
On Error GoTo 0
i = 1
If mondico2.Count = 0 Then Absent = False: Exit Function
For Each c In mondico2.keys
d(i) = c
i = i + 1
Next c
Call tri(d(), 1, mondico2.Count)
Diff = Application.Transpose(d)
End Function
Sub TotalF1enF2()
Dim Ws1, Ws2 As Worksheet
Set Ws1 = Sheets("feuil1")
Set Ws2 = Sheets("feuil2")
Set mondico = CreateObject("Scripting.Dictionary")
For Each c In Ws1.Range("a2", Ws1.[a65000].End(xlUp))
mondico(c.Value) = mondico(c.Value) + c.Offset(, 1).Value
Next c
Ws2.[E2].Resize(mondico.Count, 1) = Application.Transpose(mondico.keys)
Ws2.[f2].Resize(mondico.Count, 1) = Application.Transpose(mondico.items)
Ws2.[E1].Sort Key1:=[E2], Order1:=xlAscending, Header:=xlYes
End Sub