Function MergeMZ(champ)
Application.Volatile
Set d = CreateObject("Scripting.Dictionary")
For i = 1 To champ.Areas.Count ' parcours des zones du champ multi-zones
For j = 1 To champ.Areas(i).Rows.Count ' parcours des éléments d'une zone
If champ.Areas(i).Cells(j, 1) <> "" Then
temp = champ.Areas(i).Cells(j, 1)
temp2 = champ.Areas(i).Cells(j, 2)
d.Item(temp) = d.Item(temp) + temp2 ' ajout au dictionnaire (doublons éliminés)
End If
Next j
Next i
Dim b()
ReDim b(1 To Application.Caller.Rows.Count, 1 To 2) ' table pour retour
i = 0
For Each c In d.keys
i = i + 1
b(i, 1) = c
b(i, 2) = d(c)
Next c
MergeMZ = b
End Function