Bonsoir le forum,
Salut Patrick,
Peut-être comme ceci :
Option Explicit
Sub test()
Dim a, b(), dico As Object, i As Long, t As Byte, n As Long, w()
Set dico = CreateObject("Scripting.Dictionary")
dico.CompareMode = 1
With Sheets("Feuil1").Range("a1").CurrentRegion
a = .Value
ReDim b(1 To UBound(a, 1), 1 To 1)
For i = 2 To UBound(a, 1)
If Not dico.exists(a(i, 6)) Then
t = t + 1
If t > UBound(b, 2) Then
ReDim Preserve b(1 To UBound(b, 1), 1 To t)
End If
b(1, t) = a(i, 6)
dico(a(i, 6)) = VBA.Array(1, t)
End If
w = dico(a(i, 6))
w(0) = w(0) + 1
b(w(0), w(1)) = a(i, 3)
n = Application.Max(n, w(0))
dico(a(i, 6)) = w
Next
End With
With Sheets("Feuil2").Range("a1")
.CurrentRegion.Clear
With .Resize(n, UBound(b, 2))
.Value = b
With .Rows(1)
.BorderAround Weight:=xlThin
.Interior.ColorIndex = 37
End With
.Font.Name = "calibri"
.Font.Size = 10
.BorderAround Weight:=xlThin
.Borders(xlInsideVertical).Weight = xlThin
.VerticalAlignment = xlCenter
.Columns.AutoFit
End With
.Parent.Activate
End With
End Sub
klin89