Sub FichierTXT()
Dim t#, P&, tablo, maxi#, ncol%, fichier$, i&, j%, dercol%, x$, k&
t = Timer
If [ISERROR(LN(C1))] Then [C1] = 0
P = [C1] 'nombre de copies
tablo = Feuil1.UsedRange.Offset(1) 'matrice, plus rapide
maxi = Application.Max(tablo)
ncol = UBound(tablo, 2)
fichier = ThisWorkbook.Path & "\Fichier TXT.txt" 'à adapter
Open fichier For Output As #1
For i = 1 To UBound(tablo)
For j = ncol To 1 Step -1
If tablo(i, j) <> "" Then Exit For
Next j
dercol = j
If dercol Then
x = ""
For j = 1 To dercol
x = x & vbTab & tablo(i, j) 'concaténation
Next
x = Mid(x, 2)
Print #1, x
If tablo(i, dercol) = maxi Then
For k = 1 To P
Print #1, x
Next k
End If
End If
Next i
Close #1
MsgBox "Fichier texte créé en " & Format(Timer - t, "0.00 \sec")
VBA.Shell "notepad.exe " & fichier, vbNormalFocus 'affichage
End Sub