Bonjour à tous,
Tu peux le faire comme ça :
Ici l'item associé aux clés du dictionnaire est un objet range, on aurait pu choisir une variable tableau à 2 dimensions.
Option Explicit
Sub test()
Dim dico As Object, i As Long, n As Long, e
Set dico = CreateObject("Scripting.Dictionary")
dico.CompareMode = 1
With Sheets("Tableau_générale").Range("a3").CurrentRegion
For i = 2 To .Rows.Count
If Not dico.exists(.Cells(i, 6).Value) Then
Set dico(.Cells(i, 6).Value) = .Rows(1)
End If
Set dico(.Cells(i, 6).Value) = Union(dico(.Cells(i, 6).Value), .Rows(i))
Next
End With
Application.ScreenUpdating = False
'restitution et mise en forme
With Sheets("Feuil3")
.Cells.Clear
n = 1
For Each e In dico
dico(e).Copy .Cells(n, 1)
With .Cells(n, 1).CurrentRegion
.BorderAround Weight:=xlThin
.Borders(xlInsideVertical).Weight = xlThin
With .Rows(1)
.Font.Size = 12
.Interior.ColorIndex = 43
.BorderAround Weight:=xlThin
End With
End With
n = n + dico(e).Cells.Count / 6 + 1
Next
End With
Application.ScreenUpdating = True
Set dico = Nothing
End Sub
J'en suis resté au 1er fichier joint
klin89