M
Ming
Hi! All, I'm working on how to transfer data from a workbook to
another. I use the code :
Workbooks(" book1 .xls").Sheets("sheet1").Range("C2:C1000").Value =
Workbooks("book2.xls").Sheets("sheet2").Range("G28:G1000").Value
and it works well. But the problem is I need to use a loop to do
multiple copy and paste data from one to another. I tried to use the
code :
For i=1 to 100
Workbooks("book1 .xls").Sheets("sheet1").Range(.Cells(2, 3),
..Cells(1000, 3)).Value = _
Workbooks("book2.xls").Sheets("sheet2").Range(.Cells(28, i),
..Cells(1000, i)).Value
Next i
It can not work anymore. It showed that there's mistake for the use of
"Cells" . and I revised the code to:
For i=1 to 100
Workbooks("book1 .xls").Sheets("sheet1").Range(Cells(2, 3), Cells(1000,
3)).Value = _
Workbooks("book2.xls").Sheets("sheet2").Range(Cells(28, i), Cells(1000,
i)).Value
Next i
It didn't work. The error message says:" Run-time error '1004'
application-defined or object-defined error".
If there's possible solution for that. Please help! Thanks!
another. I use the code :
Workbooks(" book1 .xls").Sheets("sheet1").Range("C2:C1000").Value =
Workbooks("book2.xls").Sheets("sheet2").Range("G28:G1000").Value
and it works well. But the problem is I need to use a loop to do
multiple copy and paste data from one to another. I tried to use the
code :
For i=1 to 100
Workbooks("book1 .xls").Sheets("sheet1").Range(.Cells(2, 3),
..Cells(1000, 3)).Value = _
Workbooks("book2.xls").Sheets("sheet2").Range(.Cells(28, i),
..Cells(1000, i)).Value
Next i
It can not work anymore. It showed that there's mistake for the use of
"Cells" . and I revised the code to:
For i=1 to 100
Workbooks("book1 .xls").Sheets("sheet1").Range(Cells(2, 3), Cells(1000,
3)).Value = _
Workbooks("book2.xls").Sheets("sheet2").Range(Cells(28, i), Cells(1000,
i)).Value
Next i
It didn't work. The error message says:" Run-time error '1004'
application-defined or object-defined error".
If there's possible solution for that. Please help! Thanks!