Forum Discussion
Transfer data from one workbook to another
- Mar 07, 2018
Hello Mohamed,
Here is the piece of code. This may not be the best effective way, but something that can do the job for you.
' you can amend the A1:Z100 range to whatever is your actual data range
You should put this code in a module of workbook from which you want the data to be copied from.
it will copy from Sheet1 of thisworkbook into the path and file name and sheet Sheettopasteto
Sub CopyfromThisworkbookToANother()
Workbooks.Open ("C:\Documents\ExcelFiletoPasteDataTo.xlsx") ' you can amend this path and file name to you actual path and file name
ThisWorkbook.Sheets("Sheet1").Range("A1:Z100").Copy Workbooks("ExcelFiletoPasteDataTo.xlsx").Sheets("Sheettopasteto").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
Hello Mohamed,
Here is the piece of code. This may not be the best effective way, but something that can do the job for you.
' you can amend the A1:Z100 range to whatever is your actual data range
You should put this code in a module of workbook from which you want the data to be copied from.
it will copy from Sheet1 of thisworkbook into the path and file name and sheet Sheettopasteto
Sub CopyfromThisworkbookToANother()
Workbooks.Open ("C:\Documents\ExcelFiletoPasteDataTo.xlsx") ' you can amend this path and file name to you actual path and file name
ThisWorkbook.Sheets("Sheet1").Range("A1:Z100").Copy Workbooks("ExcelFiletoPasteDataTo.xlsx").Sheets("Sheettopasteto").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
- Mohamed Hasan MarieMar 07, 2018Copper Contributor
Thanks you so much Jamil for your quick replay. But unfortunately this code still not working in my sheet
- JamilMar 07, 2018Bronze Contributor
did you rename the object names from the code to the actual names of your workbooks objects?
or simply you copied and pasted the code i posted?
Can you tell me what is the name of sheet you are copying from?
what is the range to copy?
what is the workbook name to paste to?
and what is the sheet name to paste to?
which column it should be pasted to?
is the workbook you are pasting to, an open workbook, it is saved in a directory folder?
- Mohamed Hasan MarieMar 07, 2018Copper Contributor
Can you tell me what is the name of sheet you are copying from? Sheet1
what is the range to copy? A1:BB1000
what is the workbook name to paste to? Y.xlsx
and what is the sheet name to paste to? Sheet1
which column it should be pasted to? column1
is the workbook you are pasting to, an open workbook, it is saved in a directory folder? yes
But you didn't ask about the workbook name which i need to copy date from. name is X.xlsx