Sub FichiersCSV()
Dim t As Double, chemin As String, i As Long, fichier As String, x As Integer
Dim tableau As Variant, ligne As String
Dim j As Long, nbColonnes As Long
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
t = Timer
chemin = ThisWorkbook.Path & "\Fichiers CSV\"
If Dir(chemin, vbDirectory) = "" Then MkDir chemin
tableau = [A1].CurrentRegion.Value
nbColonnes = UBound(tableau, 2)
For i = 1 To UBound(tableau, 1)
fichier = chemin & Format(i, "00000") & ".csv"
ligne = ""
For j = 1 To nbColonnes
ligne = ligne & tableau(i, j) & IIf(j < nbColonnes, ";", "")
Next j
x = FreeFile
Open fichier For Output As #x
Print #x, ligne
Close #x
Next i
MsgBox Format(i - 1, "#,##0") & " fichiers CSV créés en " & Format(Timer - t, "0.00 \s")
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub