Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Paste ranges between files
How do you copy cells from 1 workbook (File A) worksheet (sheet1) to another
workbook(File B) worksheet(sheet2)? I have sucessfully written a working but not so elegant solution via activating workbooks. I am trying to write this without activating files in a loop as it is a less efficient way of running things. I am having difficulty wrapping my head around referecing ranges and worksheets across multiple forms (with out activating). workbooks("File A").worksheet("sheet1").range(cells(1,1), cells(1,11)).copy vba returns so sort of application error. Thanks in advance R |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Paste ranges between files
Thanks for the tip.
Will try this out soon Ta! R "Tom Ogilvy" wrote in message ... With workbooks("File A.xls").worksheet("sheet1") .range(.cells(1,1), .cells(1,11)).copy _ Workbooks("File B.xls").worksheets("Sheet2").Range("A1") End With Regards, Tom Ogilvy "dude" wrote in message ... How do you copy cells from 1 workbook (File A) worksheet (sheet1) to another workbook(File B) worksheet(sheet2)? I have sucessfully written a working but not so elegant solution via activating workbooks. I am trying to write this without activating files in a loop as it is a less efficient way of running things. I am having difficulty wrapping my head around referecing ranges and worksheets across multiple forms (with out activating). workbooks("File A").worksheet("sheet1").range(cells(1,1), cells(1,11)).copy vba returns so sort of application error. Thanks in advance R |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Paste ranges between files
Workbooks("File A.xls").worksheet("sheet1").range( _
workbooks("File A.xls").worksheet("sheet1").cells(1,1), _ workbooks("File A.xls").worksheet("sheet1").cells(1,11)).copy _ Workbooks("File B.xls").worksheets("Sheet2").Range("A1") or Dim sh as Worksheet set sh = workbooks("File A.xls").worksheet("sheet1") sh.Range(sh.Cells(1,1),sh.Cells(1,11)).Copy _ Workbooks("File B.xls").worksheets("Sheet2").Range("A1") Regards, Tom Ogilvy dude <wrw@spamfree wrote in message ... That works fine thanks. Just out of interest, how do you do this without using with... end with workbooks("File A.xls").worksheet("sheet1").range(.range (.cells(1,1), .cells(1,11))).copy _ Workbooks("File B.xls").worksheets("Sheet2").Range("A1") that doesnt seem to work ... Thanks, R "dude" <wrw@spamfree wrote in message ... Thanks for the tip. Will try this out soon Ta! R "Tom Ogilvy" wrote in message ... With workbooks("File A.xls").worksheet("sheet1") .range(.cells(1,1), .cells(1,11)).copy _ Workbooks("File B.xls").worksheets("Sheet2").Range("A1") End With Regards, Tom Ogilvy "dude" wrote in message ... How do you copy cells from 1 workbook (File A) worksheet (sheet1) to another workbook(File B) worksheet(sheet2)? I have sucessfully written a working but not so elegant solution via activating workbooks. I am trying to write this without activating files in a loop as it is a less efficient way of running things. I am having difficulty wrapping my head around referecing ranges and worksheets across multiple forms (with out activating). workbooks("File A").worksheet("sheet1").range(cells(1,1), cells(1,11)).copy vba returns so sort of application error. Thanks in advance R |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Paste ranges between files
Thanks Tom,
Finally understand how ranges/worksheets/workbooks work ... ta! "Tom Ogilvy" wrote in message ... Workbooks("File A.xls").worksheet("sheet1").range( _ workbooks("File A.xls").worksheet("sheet1").cells(1,1), _ workbooks("File A.xls").worksheet("sheet1").cells(1,11)).copy _ Workbooks("File B.xls").worksheets("Sheet2").Range("A1") or Dim sh as Worksheet set sh = workbooks("File A.xls").worksheet("sheet1") sh.Range(sh.Cells(1,1),sh.Cells(1,11)).Copy _ Workbooks("File B.xls").worksheets("Sheet2").Range("A1") Regards, Tom Ogilvy dude <wrw@spamfree wrote in message ... That works fine thanks. Just out of interest, how do you do this without using with... end with workbooks("File A.xls").worksheet("sheet1").range(.range (.cells(1,1), .cells(1,11))).copy _ Workbooks("File B.xls").worksheets("Sheet2").Range("A1") that doesnt seem to work ... Thanks, R "dude" <wrw@spamfree wrote in message ... Thanks for the tip. Will try this out soon Ta! R "Tom Ogilvy" wrote in message ... With workbooks("File A.xls").worksheet("sheet1") .range(.cells(1,1), .cells(1,11)).copy _ Workbooks("File B.xls").worksheets("Sheet2").Range("A1") End With Regards, Tom Ogilvy "dude" wrote in message ... How do you copy cells from 1 workbook (File A) worksheet (sheet1) to another workbook(File B) worksheet(sheet2)? I have sucessfully written a working but not so elegant solution via activating workbooks. I am trying to write this without activating files in a loop as it is a less efficient way of running things. I am having difficulty wrapping my head around referecing ranges and worksheets across multiple forms (with out activating). workbooks("File A").worksheet("sheet1").range(cells(1,1), cells(1,11)).copy vba returns so sort of application error. Thanks in advance R |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I copy big ranges of cells without drag or copy/paste? | Excel Discussion (Misc queries) | |||
Macro to copy and paste over existing files | Excel Discussion (Misc queries) | |||
use macros to copy and paste from 1 file to several files | Excel Worksheet Functions | |||
Macro 4 copy & paste between 2 books/files | Excel Discussion (Misc queries) | |||
Copy and Paste Between Files | Excel Discussion (Misc queries) |