Sub Liste_Fichiers()
Dim annee$, chemin$, P As Range, fso As Object, lig&, dossier As Object, f As Object, fichier$, x$, col%
annee = ActiveSheet.Name
'chemin = "\\192.168.0.250\shared\drh\"
chemin = ThisWorkbook.Path & "\" 'plus facile pour tester
Set P = ActiveSheet.ListObjects(1).Range 'tableau structuré
Application.ScreenUpdating = False
P(2, 1).Resize(, 13) = ""
Rows(P.Rows(3).Row & ":" & Rows.Count).Delete 'RAZ en dessous
Set fso = CreateObject("Scripting.FileSystemObject")
lig = 2
For Each dossier In fso.GetFolder(chemin).SubFolders
For Each f In dossier.Files
fichier = dossier.Name & " " & annee & ".xlsx"
If f.Name = fichier Then
P(lig, 1) = dossier.Name
x = "'" & chemin & dossier.Name & "\[" & fichier & "]"
For col = 2 To 13
P(lig, col) = ExecuteExcel4Macro(x & P(1, col) & "'!R43C7") 'cellule G43
Next col
lig = lig + 1
End If
Next f, dossier
'---compléments---
P(lig + 1, 1) = "TOTAL"
P(lig + 1, 2).Resize(, 24) = "=SUM(R2C:R" & lig - 1 & "C)"
P(lig + 2, 1) = "MOYENNE MENSUELLE"
P(lig + 2, 2).Resize(, 12) = "=AVERAGE(R2C:R" & lig - 1 & "C)"
P.EntireColumn.AutoFit 'ajustement largeurs
End Sub