ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy destination = different file / different Workbook (https://www.excelbanter.com/excel-programming/385231-copy-destination-%3D-different-file-different-workbook.html)

artisdepartis

Copy destination = different file / different Workbook
 
Hi All,

How can i set a different Workbook as my destination using the code
below or the .Copy Destination = property (Both when my destination
file is open or even when it is closed...)

I now use:

Worksheets(Sheet2).Range("A1:AA" & LastRow).Value = Range("A1:AA" &
LastRow).Value

But get a 'type mismatch' when I use
Workbooks("macro new
created.xls").Worksheets(Sheet2).Range("A1:AA" & LastRow).Value =
Range("A1:AA" & LastRow).Value

I recorded a macro, but want to try to use the above method due to
memory / speed issues.

Any help would be greatly appreciated, as always!


artisdepartis

Copy destination = different file / different Workbook
 
To clearify my question: my destination file is open when i run this
macro. (I was just wandering if it needs to be open to work).

On Mar 14, 10:39 am, "artisdepartis" wrote:
Hi All,

How can i set a different Workbook as my destination using the code
below or the .Copy Destination = property (Both when my destination
file is open or even when it is closed...)

I now use:

Worksheets(Sheet2).Range("A1:AA" & LastRow).Value = Range("A1:AA" &
LastRow).Value

But get a 'type mismatch' when I use
Workbooks("macro new
created.xls").Worksheets(Sheet2).Range("A1:AA" & LastRow).Value =
Range("A1:AA" & LastRow).Value

I recorded a macro, but want to try to use the above method due to
memory / speed issues.

Any help would be greatly appreciated, as always!




Dave Peterson

Copy destination = different file / different Workbook
 
The workbooks have to be open.

And if Sheet2 is the name of the worksheet, I think you'll want:

Worksheets("Sheet2").range(....
(with the double quotes)

artisdepartis wrote:

Hi All,

How can i set a different Workbook as my destination using the code
below or the .Copy Destination = property (Both when my destination
file is open or even when it is closed...)

I now use:

Worksheets(Sheet2).Range("A1:AA" & LastRow).Value = Range("A1:AA" &
LastRow).Value

But get a 'type mismatch' when I use
Workbooks("macro new
created.xls").Worksheets(Sheet2).Range("A1:AA" & LastRow).Value =
Range("A1:AA" & LastRow).Value

I recorded a macro, but want to try to use the above method due to
memory / speed issues.

Any help would be greatly appreciated, as always!


--

Dave Peterson


All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com