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 50 51 52
|
Sub test()
BoEcran = Application.ScreenUpdating
BoBarre = Application.DisplayStatusBar
iCalcul = Application.EnableEvents
BoEvent = Application.EnableEvents
BoSaut = ActiveSheet.DisplayPageBreaks
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False
Dim ws As Worksheet
Dim monFichier As String
Dim wb As Workbook
Dim chemin As String
Dim i As Integer
Dim nom As String
Dim FichierMain As String
Set wb = Workbooks(ThisWorkbook.Name)
Dim sh As Worksheet
chemin = ThisWorkbook.Path & "\mon_dossier\"
monFichier = Dir(chemin & "*.xlsx", vbNormal)
Do While monFichier <> ""
Debug.Print monFichier
onglet = Split(monFichier, "_")(4)
wb.Sheets.Add(After:=Worksheets(Worksheets.Count)).Name = onglet
For Each sh In ActiveWorkbook.Worksheets
'R?cup?rer uniquement les valeurs de la ligne 8 ? 150
For i = 8 To 150
'Montant
j = 4
Cells(i - 4, j - 2).Formula = "='" & ThisWorkbook.Path & "\[" & monFichier & "]Solde'!R" & i & "C" & j:
Next
Next sh
monFichier = Dir
Loop
Application.ScreenUpdating = True 'Facultatif
BoEcran = Application.ScreenUpdating = BoEcran
BoBarre = Application.DisplayStatusBar = BoBarre
iCalcul = Application.EnableEvents = iCalcul
BoEvent = Application.EnableEvents = BoEvent
BoSaut = ActiveSheet.DisplayPageBreaks = BoSaut
End Sub |
Partager