Slt Céd,
Slt Jean-Eric,
essaie comme ca:
Sub Condense_detail()
Dim rng As Range, Lstrw As Long, rngborder As Range, r As Range
Dim SpltRng As Range
Dim RefRng As Range
Dim i As Integer, c As Integer
Dim Cumul As Variant
Dim txt As String, txtRef As String
Lstrw = Cells(Rows.Count, "D").End(xlUp).Row
Set rng = Range("D2:D" & Lstrw)
For Each r In rng.Cells
Set RefRng = r.Offset(, -1)
Set SpltRng = r.Offset(, 1)
txtRef = RefRng.Value
txt = SpltRng.Value
Cumul = Split(txt, " ")
If UBound(Cumul) < r - 1 Then
c = 3
ElseIf UBound(Cumul) > r - 1 Then
c = 6
Else: c = -4142
End If
Cells(Rows.Count, "I").End(xlUp).Offset(1, -1) = r
For i = 0 To UBound(Cumul)
Cells(Rows.Count, "I").End(xlUp).Offset(1, -1).Interior.ColorIndex = c
Cells(Rows.Count, "H").End(xlUp).Offset(i, 1).Interior.ColorIndex = c
Cells(Rows.Count, "H").End(xlUp).Offset(i, 1) = txtRef
Cells(Rows.Count, "H").End(xlUp).Offset(i, 2).Interior.ColorIndex = c
Cells(Rows.Count, "H").End(xlUp).Offset(i, 2) = Cumul(i)
Next i
Next r
Lstrw = Cells(Rows.Count, "J").End(xlUp).Row
Set rngborder = Range("H1:J" & Lstrw)
With rngborder.Borders
.LineStyle = xlContinuous
.Color = vbBlack
.Weight = xlThin
End With
End Sub