![]() |
Macro to Move cells
Sorry I mean copy from doc1 range a2:f2 to doc2 range a1:f1
"sebastienm" wrote: to a new file do you mean new book or a new sheet withing the same book? In any case, use the syntax: range.cut destination_range eg: workbooks("my book.xls").Worksheets("sheet1").Range("a1:f2").Cut _ workbooks("book2").Worksheets("sheet2").Range("a1" ) In this case it is from a book to another book. I you want to copy and not cut, use the Copy method. It works the same way. Regards, Sébastien "Weasel" wrote: I'm trying to move a range of cells to a new file and new range I can't get it to work. eg. doc name: sheet1 range: a2:f2 new file: sheet2 new range: a1:f1 Any help would be appreciated |
Macro to Move cells
ok, you can use the Copy method instead of the Cut method. The syntax is
exactly the same, just replace Cut by Copy. Of course, it assumes both books are open. If it is the same book, just use the same name for origin and destination. One thing to pay attention to is the book names: If a book is not samed yet, its name has no extension eg: Workbooks("book1") . If it has already been saved , its name has an extension that needs to be included: Workbooks("book1.xls). Regards, Sebastien "Weasel" wrote: Sorry I mean copy from doc1 range a2:f2 to doc2 range a1:f1 "sebastienm" wrote: to a new file do you mean new book or a new sheet withing the same book? In any case, use the syntax: range.cut destination_range eg: workbooks("my book.xls").Worksheets("sheet1").Range("a1:f2").Cut _ workbooks("book2").Worksheets("sheet2").Range("a1" ) In this case it is from a book to another book. I you want to copy and not cut, use the Copy method. It works the same way. Regards, Sébastien "Weasel" wrote: I'm trying to move a range of cells to a new file and new range I can't get it to work. eg. doc name: sheet1 range: a2:f2 new file: sheet2 new range: a1:f1 Any help would be appreciated |
All times are GMT +1. The time now is 12:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com