VBA - макрос для створення багатошарових зведених таблиць

VBA - макрос для створення багатошарових зведених таблиць

У цьому посібнику ми будемо використовувати об'єкт "Словник", в двовимірному масиві (змінному).

Книга

Книга перегрупування продажів, щомісяця, продавець і продані продукти.

Книга містить 12 аркушів, по одному на кожен місяць.

У кожному з цих аркушів три стовпці:

- колонка А: імена продавця,

- Колонка В: назви реалізованої продукції,

- Колонка С: сума.

Код VBA

Щоб інтегрувати VBA у вашу книгу, скопіюйте весь код нижче.

  • Натисніть ALT + F11
  • Натисніть кнопку Вставити / Модуль
  • Вставте код.

Закрийте редактор Visual Basic, щоб повернутися до робочої книги, потім натисніть ALT + F8, виберіть " RécapAvecSommeDesColonnesC ", потім натисніть "Виконати".

Змініть на зручність:

- Назва аркуша récap

- "Вихідні" колонки: A, B і C

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Option Explicit Sub RécapAvecSommeDesColonnesC() Dim Feuille As Worksheet, i As Long Dim TablVendeurs(), DicoVendeurs As Object Dim TablVentes(), DicoVentes As Object Dim Sommes() Set DicoVendeurs = CreateObject("Scripting.Dictionary") Set DicoVentes = CreateObject("Scripting.Dictionary") '*******REMPLISSAGE DES OBJETS DITIONARY ET VARIABLES******* 'remplissage des étiquettes de lignes et de colonnes sans doublons For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille TablVendeurs = .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For i = LBound(TablVendeurs, 1) To UBound(TablVendeurs, 1) If Not DicoVendeurs.exists(TablVendeurs(i, 1)) Then DicoVendeurs.Add TablVendeurs(i, 1), TablVendeurs(i, 1) Next i TablVentes = .Range("B2", .Range("B" & Rows.Count).End(xlUp)) For i = LBound(TablVentes, 1) To UBound(TablVentes, 1) If Not DicoVentes.exists(TablVentes(i, 1)) Then DicoVentes.Add TablVentes(i, 1), TablVentes(i, 1) Next i End With End If Next Feuille 'remplissage de la variable tableau 2D grâce aux clés de Dictionary ReDim Sommes(1 To DicoVendeurs.Count, 1 To DicoVentes.Count) For Each Feuille In ThisWorkbook.Worksheets If Feuille.Name "Récap" Then With Feuille For i = 2 To .Range("A" & Rows.Count).End(xlUp).Row Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) = Sommes(Application.Match(.Cells(i, 1), DicoVendeurs.keys, 0), Application.Match(.Cells(i, 2), DicoVentes.keys, 0)) + .Range("C" & i).Value Next i End With End If Next Feuille '*******RESTITUTION DES DONNEES******* With Sheets("Récap") .Range("A2").Resize(DicoVendeurs.Count, 1) = Application.Transpose(DicoVendeurs.keys) .Range("B1").Resize(1, DicoVentes.Count) = DicoVentes.keys .Range("B2").Resize(UBound(Sommes, 1), UBound(Sommes, 2)) = Sommes() End With End Sub

Завантажити посилання

Ви можете завантажити зразок аркуша:

  • Зразок формату аркушів .xlsm (Excel> 2007) - 1, 19 Мо
  • Зразок формату аркушів .xls (Excel <2007) - 3, 86 Мо
Попередня Стаття Наступна Стаття

Кращі Поради