I've got an issue about exporting data from SAP to Excel. After few copy/paste my code stops and can't find either mother file or exported file . Is there any way to delete this issue?. On my own I can always fix it by just clicking "F5" or clicking mother/exported files and after that "F5". But want to let this code run automatically so it can't have any errors.
It can happen on second copy or third, sometimes never happens.
ostatni_transport = Workbooks(ten_plik).Worksheets("TR").Cells(1, 1).End(xlDown).Row
Workbooks("Arkusz w ALVXXL01 (1)").Sheets(1).Range(Cells(2, 1), Cells(Cells(1, 1).End(xlDown).Row, 7)).Copy
Workbooks(ten_plik).Worksheets("TR").Cells(ostatni_transport + 1, 1).PasteSpecial xlPasteValues 'A-G
Workbooks("Arkusz w ALVXXL01 (1)").Sheets(1).Range(Cells(2, 8), Cells(Cells(1, 1).End(xlDown).Row, 8)).Copy
Workbooks(ten_plik).Worksheets("TR").Cells(ostatni_transport + 1, 10).PasteSpecial xlPasteValues 'J
Workbooks("Arkusz w ALVXXL01 (1)").Sheets(1).Range(Cells(2, 10), Cells(Cells(1, 1).End(xlDown).Row, 10)).Copy
Workbooks(ten_plik).Worksheets("TR").Cells(ostatni_transport + 1, 8).PasteSpecial xlPasteValues 'H
Workbooks("Arkusz w ALVXXL01 (1)").Sheets(1).Range(Cells(2, 11), Cells(Cells(1, 1).End(xlDown).Row, 11)).Copy
Workbooks(ten_plik).Worksheets("TR").Cells(ostatni_transport + 1, 9).PasteSpecial xlPasteValues 'I
Is there any way to fix it? I can't change overlay of data, that's why I've got to copy and paste it a few times.
I tried to specify cells more accurately with workbook&worksheet before cells - sadly didn't help.