ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy worksheet to another file (https://www.excelbanter.com/excel-programming/396007-copy-worksheet-another-file.html)

AlanW

Copy worksheet to another file
 
I want to copy a worksheet from File A to the cell "R1" of a worksheet in
File B by using VBA. Could someone please show me the way.

Thank you.

Bob Umlas

Copy worksheet to another file
 
You can't copy a worksheet to a cell. You copy cells to cells, worksheets to
worksheets. If you want to copy all the cells in a worksheet to another
worksheet beginning in R1, it's possible, but you no longer have all the
columns available. Maybe something like this:
Workbooks("Book6").Sheets(1).Cells.Resize(Cells.Ro ws.Count,
Cells.Columns.Count - 18).Copy
Workbooks("Book5").Sheets(1).Range("R1").PasteSpec ial
Bob Umlas
Excel MVP


"AlanW" wrote in message
...
I want to copy a worksheet from File A to the cell "R1" of a worksheet in
File B by using VBA. Could someone please show me the way.

Thank you.




JLGWhiz

Copy worksheet to another file
 
Excel will not allow you to copy a larger range to a smaller range. If you
want to copy part of File A to a specific area of File B then you must be
sure that the receiving range is equal to or larger than the source range.
The code would be

Sheets("FileA").Range("A1:B5").Copy Sheets("FileB").Range("R1")

Where you would use your actual file names and the actual range to copy.

"AlanW" wrote:

I want to copy a worksheet from File A to the cell "R1" of a worksheet in
File B by using VBA. Could someone please show me the way.

Thank you.


AlanW

Copy worksheet to another file
 
Hello JLGWhiz

What I would like to do is to copy the whole range to a new file starting
from the Cell R1. Could you please show me the whole procedure. By the way,
shall I activate / open the destination file before copying.

Many Thanks
"AlanW" wrote:

I want to copy a worksheet from File A to the cell "R1" of a worksheet in
File B by using VBA. Could someone please show me the way.

Thank you.



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

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