Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to move one cell down | Excel Worksheet Functions | |||
Can references (to cells being sorted) move with the cells? | Setting up and Configuration of Excel | |||
Macro to move row from one worksheet to another | Excel Discussion (Misc queries) | |||
Sorting cells: a list behind the cells do not move with the cell | Excel Discussion (Misc queries) | |||
Macro to move to specified cells, pause for input at each? | Excel Discussion (Misc queries) |