rivate Sub CommandButton1_Click()
Dim Lig, Col, x0, x1 As Long
Dim b0, b1, b2, d, dv As String
Dim Fic, adxirs, adxifs As String
Do While Fic = ''
Fic = InputBox('Veuillez donner le nom du Fichier de sortie', 'NomFichier')
Loop
d = Chr$(34)
dv = d + ';'
Sheets('donttouch').Activate
Range('A1').Activate
Open Fic For Output As #1
b0 = ''
x0 = 0
Lig = 1
Do While ActiveCell.Offset(Lig, 0).Text <> ''
b1 = ActiveCell.Offset(Lig, 0).Text
x0 = x0 + 1
If x0 = 185 Then
x0 = 0
b0 = ''
End If
If b0 <> b1 Then
'---- nouvelle commande
Print #1, d & 'E' & dv;
Print #1, d & ActiveCell.Offset(Lig, 0).Text & dv;
Print #1, d & ActiveCell.Offset(Lig, 2).Text & dv;
Print #1, d & ActiveCell.Offset(Lig, 1).Text & d
b0 = b1
End If
Print #1, d & 'L' & dv;
Print #1, d & ActiveCell.Offset(Lig, 3).Text & dv;
Print #1, d & ActiveCell.Offset(Lig, 4).Text & d
Lig = Lig + 1
Loop
Close #1
MsgBox ('Fichier ' & Fic & ' généré !')
End Sub