Option Explicit
Sub ExportCSV()
Dim Tbl As Variant, TblTemp As Variant, FileNumber&, i&, j&, chemin$
Dim d As Object, Code As String, Tbl1(), Tbl2()
FileNumber = FreeFile
chemin = ThisWorkbook.Path & "\" 'Fichier sur le même répertoire
chemin = chemin & "Import_" & Sheets("TEST").Cells(2, 1) & Format(Date, "_YYYY_MM_DD") & "_" & Format(Time, "hhmmss") & ".csv"
Tbl = Range("EXEMPLE").Value
'''''''''''''''''''''''''''''''''''''''''''''''
Code = "C"
Set d = CreateObject("scripting.dictionary")
For i = 1 To UBound(Tbl)
If Tbl(i, 3) = Code Then d(i) = "" ' on stocke les nos de ligne
Next i
Tbl1 = Application.Index(Tbl, Application.Transpose(d.keys), Array(2, 3, 4)) 'extract Array
ReDim TblTemp(LBound(Tbl1, 2) To UBound(Tbl1, 2))
Open chemin For Output As #FileNumber
For i = LBound(Tbl1, 1) To UBound(Tbl1, 1)
For j = 1 To UBound(Tbl1, 2)
TblTemp(j) = Tbl1(i, j)
Next j
Print #FileNumber, Join(TblTemp, ";")
Next i
Close #FileNumber
MsgBox "Terminé!"
End Sub