Bonsoir M12, mirjules, le forum
Dans le module de la Feuil1.
A tester :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x, a, b(), i As Long, n As Long, pos
If Target.Address <> "$I$2" Then Exit Sub
Application.EnableEvents = False
On Error Resume Next
With Target.CurrentRegion
.Offset(3).Resize(.Rows.Count - 3).Clear
End With
On Error GoTo 0
With Range("a3").CurrentRegion
x = Filter(.Parent.Evaluate("transpose(if(countif(offset(" & .Columns(3).Address & _
",,,row(1:" & .Rows.Count & "))," & .Columns(3).Address & ")=1," & .Columns(3).Address & _
",char(2)))"), Chr(2), 0): a = .Value
ReDim b(1 To .Rows.Count, 1 To UBound(x) + 1)
For i = 1 To UBound(x)
b(1, i + 1) = x(i)
Next
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 2 To UBound(a, 1)
If Not .exists(a(i, 6)) Then
.Item(a(i, 6)) = .Count + 2
b(.Item(a(i, 6)), 1) = a(i, 6)
End If
If a(i, 2) = Target.Value Then
pos = Application.Match(a(i, 3), x, 0)
b(.Item(a(i, 6)), pos) = a(i, 1)
End If
Next
n = .Count + 1
End With
End With
With Range("I4").Resize(n, UBound(b, 2))
.Value = b
With .CurrentRegion
.Font.Name = "calibri"
.Font.Size = 11
.VerticalAlignment = xlCenter
With .Offset(3).Resize(.Rows.Count - 3)
.BorderAround Weight:=xlThin
.Borders(xlInsideVertical).Weight = xlThin
.Borders(xlInsideHorizontal).Weight = xlThin
.Cells(1).Interior.ColorIndex = 16
End With
End With
End With
Application.EnableEvents = True
End Sub
klin89