Option Explicit
Sub Tst2()
Dim Tableau, ligne As String, i As Long, j As Long, NumFichier As Integer
Const sSep As String = ";"
NumFichier = FreeFile
Tableau = ThisWorkbook.Worksheets(1).UsedRange
Open ThisWorkbook.Path & "\" & "essai.csv" For Output As #NumFichier
For i = LBound(Tableau, 1) To UBound(Tableau, 1)
ligne = Tableau(i, LBound(Tableau, 2))
For j = LBound(Tableau, 2) + 1 To UBound(Tableau, 2)
ligne = ligne & sSep & Tableau(i, j)
Next j
Print #NumFichier, ligne
Next i
Close NumFichier
End Sub
|