1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Public Sub es()
Dim wbkSource As Workbook, wbkDest As Workbook
Dim stFichier As String, stExistFich As String
Application.ScreenUpdating = True
Set wbkSource = ActiveWorkbook
stFichier = "CheminCompletDeTonFichierDeDestination.xls"
stExistFich = Dir(stFichier)
If stExistFich = "" Then
Workbooks.Add (1)
Set wbkDest = ActiveWorkbook
wbkDest.SaveAs Filename:=stFichier
Else
Set wbkDest = Workbooks.Open(stFichier)
End If
'ici prévoir un test sur l'inexistence de Feuille dans le classeur cible
wbkSource.Sheets("Feuille").Copy after:=wbkDest.Sheets(wbkDest.Sheets.Count)
wbkDest.Save
wbkDest.Close
Set wbkSource = Nothing
Set wbkDest = Nothing
Application.ScreenUpdating = True
End Sub |
Partager