Hello tout le monde,
j ai un souci avec ma macro...qui me permet de copier des infos, d ouvrir un autre fichier et d y coller les infos tout en trouvant la derniere ligne remplie.
Or a chaque fois, apparait le message "La méthode PASTESPECIAL de l objet Range a échoué....
Or voici la macro
Public Sub TCD()
Dim chemin As String
Dim nom As String
Dim xlapp As Object
Dim xlbook As Workbook
Dim xlsheet As Worksheet
Sheets("Feuil1").Visible = True
Sheets("Feuil1").Activate
Sheets("Feuil1").Select
Sheets("Feuil1").Range("B2", Sheets("Feuil1").Range("M2").End(xlDown)).Select
Selection.Copy
chemin = "G:\GESTION FINANCE & COMPTABILITE\Base de données\Historique Aeroports Perdus"
nom = "RECUPERE PAR MACRO"
Set xlapp = CreateObject("Excel.Application")
Set xlbook = xlapp.Workbooks.Open(chemin)
Set xlsheet = xlbook.Worksheets(nom)
xlsheet.Activate
xlsheet.Range("B3").End(xlDown).Offset(1, 0).PasteSpecial (xlPasteValues)
Set xlsheet = xlbook.Worksheets("RAPPORT")
xlsheet.PivotTables("Lost").RefreshTable
Set xlsheet = Nothing
xlbook.Save
xlbook.Close
Set xlbook = Nothing
ActiveWindow.SelectedSheets.Visible = False
End Sub
Quelqu un aurait il une idée?
Un grand merci;
Linchpin
j ai un souci avec ma macro...qui me permet de copier des infos, d ouvrir un autre fichier et d y coller les infos tout en trouvant la derniere ligne remplie.
Or a chaque fois, apparait le message "La méthode PASTESPECIAL de l objet Range a échoué....
Or voici la macro
Public Sub TCD()
Dim chemin As String
Dim nom As String
Dim xlapp As Object
Dim xlbook As Workbook
Dim xlsheet As Worksheet
Sheets("Feuil1").Visible = True
Sheets("Feuil1").Activate
Sheets("Feuil1").Select
Sheets("Feuil1").Range("B2", Sheets("Feuil1").Range("M2").End(xlDown)).Select
Selection.Copy
chemin = "G:\GESTION FINANCE & COMPTABILITE\Base de données\Historique Aeroports Perdus"
nom = "RECUPERE PAR MACRO"
Set xlapp = CreateObject("Excel.Application")
Set xlbook = xlapp.Workbooks.Open(chemin)
Set xlsheet = xlbook.Worksheets(nom)
xlsheet.Activate
xlsheet.Range("B3").End(xlDown).Offset(1, 0).PasteSpecial (xlPasteValues)
Set xlsheet = xlbook.Worksheets("RAPPORT")
xlsheet.PivotTables("Lost").RefreshTable
Set xlsheet = Nothing
xlbook.Save
xlbook.Close
Set xlbook = Nothing
ActiveWindow.SelectedSheets.Visible = False
End Sub
Quelqu un aurait il une idée?
Un grand merci;
Linchpin