Sub demandeàtraiter
Dim i as integer '<---- déclaration de variable
Workbooks.Open Filename:= _
"G:\Voy-Prestations\Statistiques courrier\Statistiques&Correspondances-2011.xls"
Windows("Hebdo-2011 - Courbes(TO+MO).xls").Activate
With Application '<---- 4 lignes pour accélérer le traitement
.Screenupdating=False
.Calculation=xlManual
End With
For i=1 to 52 '<---- Début de la boucle
Worksheets(i).Select
Range("I7").Select
ActiveCell.FormulaR1C1 = _
"='[Statistiques&Correspondances-2011.xls]Rapport hebdo'!R[2]C[-5]"
Selection.AutoFill Destination:=Range("I7:N7"), Type:=xlFillDefault
Range("I8").Select
ActiveCell.FormulaR1C1 = _
"='[Statistiques&Correspondances-2011.xls]Rapport hebdo'!R[2]C[-5]"
Selection.AutoFill Destination:=Range("I8:N8"), Type:=xlFillDefault
Range("I13").Select
ActiveCell.FormulaR1C1 = _
"='[Statistiques&Correspondances-2011.xls]Rapport hebdo'!R[-7]C[-5]+'[Statistiques&Correspondances-2011.xls]Rapport hebdo'!R[-1]C[-5]"
Selection.AutoFill Destination:=Range("I13:N13"), Type:=xlFillDefault
Range("I14").Select
ActiveCell.FormulaR1C1 = _
"='[Statistiques&Correspondances-2011.xls]Rapport hebdo'!R[-7]C[-5]+'[Statistiques&Correspondances-2011.xls]Rapport hebdo'!R[-1]C[-5]"
Selection.AutoFill Destination:=Range("I14:N14"), Type:=xlFillDefault
Range("N7:N8,N13:N14").Select
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Next '<---- Fin de la boucle
With Application '<---- Réactivation des paramètres du classeurs désactivés plus haut
.Calculation=xlAutomatic
.Screenupdating=True
End With
Windows("Statistiques&Correspondances-2011.xls").Activate
ActiveWorkbook.Save
ActiveWorkbook.Close
Windows("Hebdo-2011 - Courbes(TO+MO).xls").Activate
Sheets("Statistiques").Select
ActiveWorkbook.Save
Range("I8").Select
End Sub