Sub Compiler_XLSX()
Dim wb_A As Workbook, WBKS As Workbook, strPath$, fXLSX$, i&
On Error GoTo ErrHandler
With Application.FileDialog(4)
.AllowMultiSelect = 0: .Title = "Choisir le répertoire"
If .Show = -1 Then strPath = .SelectedItems(1)
End With
If strPath = "" Then Exit Sub
Application.ScreenUpdating = False
Set wb_A = ThisWorkbook: i = 1
fXLSX = Dir(strPath & "\*.xlsx")
Do While fXLSX <> vbNullString
Set WBKS = Workbooks.OpenXML(strPath & "\" & fXLSX)
WBKS.Sheets(1).Copy After:=wb_A.Sheets(wb_A.Sheets.Count)
wb_A.Sheets(wb_A.Sheets.Count).Name = Split(fXLSX, ".")(0)
WBKS.Close False
i = wb_A.Sheets(1).UsedRange.Rows.Count + 2
fXLSX = Dir()
Loop
Application.ScreenUpdating = True
wb_A.Save
Exit Sub
ErrHandler:
MsgBox "Aucun fichier XLSX!", vbCritical, "Erreur"
End Sub