Sub ZZ_TT()
Dim ncol%, t, rest(), i&, n&, j%
With [A2].CurrentRegion 'adapter éventuellement
ncol = IIf(.Columns.Count < 5, 5, .Columns.Count)
t = .Resize(, ncol) 'matrice, plus rapide
ReDim rest(1 To UBound(t) - Application.CountIf([A:A], "~*") + Application.CountIf([E:E], "*ZZ") + Application.CountIf([E:E], "*TT"), 1 To ncol)
For i = 2 To UBound(t)
If t(i, 1) <> "*" Then 'la ligne avec "*" est ignorée
n = n + 1
For j = 1 To ncol: rest(n, j) = t(i, j): Next j
If Right(t(i, 5), 2) = "ZZ" Or Right(t(i, 5), 2) = "TT" Then
n = n + 1
For j = 2 To ncol: rest(n, j) = t(i, j): Next j
rest(n, 1) = "*"
rest(n, 5) = Left(t(i, 5), Len(t(i, 5)) - 2)
End If
End If
Next i
'---restitution---
If .Parent.FilterMode Then .Parent.ShowAllData 'si la feuille est filtrée
If n Then .Offset(1).Resize(n, ncol) = rest
.Offset(n + 1).Resize(Rows.Count - n - .Row, ncol).ClearContents 'RAZ sous le tableau
With .Parent.UsedRange: End With 'actualise la barre de défilement verticale
End With
End Sub