Bonjour à tous
une version plus simple
Sub Arborer()
debL = Cells(1, 1).End(xlDown).Row
finL = Cells(debL, 1).End(xlDown).Row
finC = Cells(debL, 1).End(xlToRight).Column
Cells(debL, finC + 1).FormulaR1C1 = "Nombre de composants"
Cells(debL + 1, finC + 1).FormulaR1C1 = "=COUNTIF(OFFSET(RC[-" & finC & "],1,,COUNTA(C[-" & finC & "])+ROW()),RC[-" & finC & "]&""*"")"
Cells(debL + 1, finC + 1).Select
Selection.AutoFill Destination:=Range(Cells(debL + 1, finC + 1), Cells(finL, finC + 1))
With ActiveSheet.Outline
.AutomaticStyles = False
.SummaryRow = xlAbove
.SummaryColumn = xlRight
End With
For i = finL To debL + 1 Step -1
If Cells(i, finC + 1) > 0 Then Rows((i + 1) & ":" & (i + Cells(i, finC + 1))).Rows.Group
Next
End Sub