Bonsoir dadou482,
Salut U. Milité,
Un essai,
il faut convertir les données des colonnes N et Q de la feuille ""PCA" au format nombre si tu veux les additionner
Option Explicit
Sub test()
Dim a, i As Long, j As Byte, w(), e, dico As Object
Set dico = CreateObject("Scripting.Dictionary")
dico.CompareMode = 1
Application.ScreenUpdating = False
a = Sheets("base").Range("a1").CurrentRegion.Value
For i = 1 To UBound(a, 1)
dico(a(i, 1)) = Empty
Next
With Sheets("PCA").Range("A1").CurrentRegion
a = Application.Index(.Value, Evaluate("row(1:" & _
.Rows.Count & ")"), Array(1, 2, 6, 7, 8, 14, 17))
End With
For i = 2 To UBound(a, 1)
If dico.exists(a(i, 1)) Then
If IsEmpty(dico(a(i, 1))) Then
ReDim w(1 To UBound(a, 2))
For j = 1 To UBound(a, 2)
w(j) = a(i, j)
Next
Else
w = dico(a(i, 1))
w(UBound(w) - 1) = w(UBound(w) - 1) + a(i, 6)
w(UBound(w)) = w(UBound(w)) + a(i, 7)
End If
dico(a(i, 1)) = w
End If
Next
For Each e In dico.keys
If IsEmpty(dico(e)) Then dico.Remove e
Next
If dico.Count > 0 Then
With Sheets("Feuil2").Cells(1).CurrentRegion
With .Offset(1)
.ClearContents
.Resize(dico.Count, 7).Value = Application.Index(dico.items, 0, 0)
End With
End With
End If
Application.ScreenUpdating = True
Set dico = Nothing
End Sub
Mais bon, j'ai un doute quant à la valeur à afficher dans la colonne "Nom Rayon" en "feuil2" puisque la macro ne renvoie qu'une ligne par magasin
La colonne "Nom rayon" est donc inutile
klin89