J'ai lu cette discussion.

Citation Envoyé par kiki29 Voir le message
Salut, à adapter à ton contexte, fusionne les XLS ou les CSV
J'ai trouvé ce code qui t'appartient,

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Option Explicit 
 
Private Sub ConcatenationCSV(sDossier As String) 
Dim Wkb As Workbook 
Dim sChemin As String, sFichier As String 
Dim LastRow As Long, iRow As Long 
Dim c As Range, Ar() As String 
Const sSeparateur As String = ";" 
 
    Application.ScreenUpdating = False 
 
    sChemin = sDossier & "\" 
    sFichier = Dir$(sChemin & "*.csv" ) 
 
    Feuil1.Cells.Clear 
    Do While Len(sFichier) > 0 
 
        Set Wkb = Workbooks.Open(sChemin & sFichier) 
        LastRow = Wkb.Sheets(1).Cells(Wkb.Sheets(1).Rows.Count, 1).End(xlUp).Row 
 
        With Feuil1 
            For Each c In Wkb.Sheets(1).Range("A1:A" & LastRow) 
                iRow = .Cells(.Rows.Count, 1).End(xlUp).Row + 1 
                Ar = Split(c, sSeparateur) 
                .Range(.Cells(iRow, 1), .Cells(iRow, UBound(Ar) + 1)).Value = Ar 
            Next c 
        End With 
 
        Wkb.Close 
        Set Wkb = Nothing 
 
        sFichier = Dir$() 
    Loop 
    Application.ScreenUpdating = True 
End Sub 
 
Sub SelDossierCSV() 
    With Application.FileDialog(msoFileDialogFolderPicker) 
        .InitialFileName = ThisWorkbook.Path & "\" 
        .Title = "Dossier CSV à traiter" 
        .AllowMultiSelect = False 
        .ButtonName = "Sélection Dossier" 
        .Show 
        If .SelectedItems.Count > 0 Then 
            DoEvents 
            ConcatenationCSV .SelectedItems(1) 
        End If 
    End With 
End Sub
J'ai essayé de l’exécuter, mais une fois l’exécution arrive à l’étape
ConcatenationCSV.SelectedItems(1)
j'ai l'erreur de compilation : argument non facultatif. Sachant que j'ai remplacer sDossier dans sChemin par le chemin vers le dossier contenant les fichiers CSV.

Merci.