Application.ScreenUpdating = False
Dim I As Integer, J As Integer, Plage As Range
Sheets("Service1").Select
Set Plage = Range(Cells(1, 1), Range("A1").End(xlToRight))
J = Plage.Count
Plage.Copy
Sheets("Fiche individuelle 6 périodes").Range("S3").PasteSpecial _
Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
Application.CutCopyMode = False
With Plage
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
.Sort Key1:=Range("S3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
Sheets("Switch").Range("K1").FormulaR1C1 = "Service1"
Sheets("Fiche individuelle 6 périodes").Select
Application.SheetsInNewWorkbook = I
Workbooks.Add
Application.SheetsInNewWorkbook = 3
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Administrateur\Bureau\Heures 2009\Récolte des fiches" _
& "\Service1\Fiches individuelles Service1.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Windows("Base.xls").Activate
For I = 1 To J
Range("P3").FormulaR1C1 = "=R[" & (I - 1) & "]C[3]"
Range("B1:P66").Copy
Windows("Fiches individuelles Service1.xls").Activate
With Sheets("Feuil" & I).Range("A1")
.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End With
Sheets("Feuil" & I).PageSetup.PrintArea = "$A$1:$O$66"
Sheets("Feuil" & I).Name = Range("O3").Value
Application.ExecuteExcel4Macro "PAGE.SETUP(,,0.7,0.2,0.2,0.2,,,TRUE,TRUE,1,9,true ,,,,,0.2,0.2,FALSE,FALSE)"
Next I
Windows("Base.xls").Activate
Sheets("Fiche individuelle 6 périodes").Select
Range("S3:S20").Clear
Application.ScreenUpdating = True