Sub Consolider_()
Dim t#, chemin$, fichier$, nomfeuil$, nfich%, f$, g$, wb As Workbook
t = Timer
chemin = ThisWorkbook.Path & "\" 'dossier à adapter
fichier = Dir(chemin & "*.xls*") '1er fichier du dossier
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
nomfeuil = "Feuil3" 'nom à adapter
ThisWorkbook.Unprotect "0000"
ActiveSheet.Unprotect "0000"
'---formule concaténée---
While fichier <> ""
If fichier <> ThisWorkbook.Name Then
nfich = nfich + 1
f = f & IIf(f = "", "='", "+'") & chemin & "[" & fichier & "]" & nomfeuil & "'!C11"
g = g & IIf(g = "", "='", "+'") & chemin & "[" & fichier & "]" & nomfeuil & "'!E18"
End If
fichier = Dir 'fichier suivant
Wend
'--remplissage du tableau---
With [C11:D14] 'plage à adapter
.Formula = f
.Value = .Value 'supprime les formules
End With
With [E18:L57] 'plage à adapter
.Formula = g
.Value = .Value 'supprime les formules
End With
ActiveSheet.Protect "0000"
ThisWorkbook.Protect "0000"
MsgBox nfich & " fichiers consolidés en " & Format(Timer - t, "0.00 \s")
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub