1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Sub copie_save()
Dim Wb As Workbook, ws As Worksheet
Dim nom As String
Dim i As Integer
Application.ScreenUpdating = False
Set Wb = Workbooks.Open("C:\Bureau\ENTPRO.xls") 'fichier support
Set ws = Wb.Sheets("Recueil données") ' cette feuille est masquée dans le classeur ENTPRO
For i = 119 To 130
ThisWorkbook.Sheets("Base Agent").Rows(i).Copy 'fichier source
ws.Rows(2).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
nom = ws.Range("a3").Value & ".xls"
Wb.SaveAs "C:\Documents and Settings\6467\Bureau\" & nom ' ligne où se situe l'erreur
Next
Wb.Close
Application.CommandBars("cell").Enabled = True
End Sub |
Partager