ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy file (https://www.excelbanter.com/excel-discussion-misc-queries/155289-copy-file.html)

AlanW

Copy file
 
I have a worksheet in FileA and I want to copy it to the range from R1 to X10
of FileB by using VBA. Could someone please show me the procedures. By the
way, shall I activate / open FileB before copying.

Many Thanks

Duke Carey

Copy file
 
Workbooks("FileA.xls").worksheets("Sheet1").range( "R1:X10").copy
Destination:= _
Workbooks("FileB.xls").worksheets("Sheet1").range( "R1:X10")

Adjust the first range ("R1:X10") to reflect the range you are actually
copying. Same for both filenames and Sheet names

"AlanW" wrote:

I have a worksheet in FileA and I want to copy it to the range from R1 to X10
of FileB by using VBA. Could someone please show me the procedures. By the
way, shall I activate / open FileB before copying.

Many Thanks


Dave Peterson

Copy file
 
Try turning on the macro recorder when you do it manually.

You'll see code that works.

AlanW wrote:

I have a worksheet in FileA and I want to copy it to the range from R1 to X10
of FileB by using VBA. Could someone please show me the procedures. By the
way, shall I activate / open FileB before copying.

Many Thanks


--

Dave Peterson


All times are GMT +1. The time now is 02:16 PM.

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