Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to move one cell down tjb Excel Worksheet Functions 13 April 22nd 08 09:52 PM
Can references (to cells being sorted) move with the cells? Zack Setting up and Configuration of Excel 1 January 16th 08 01:50 PM
Macro to move row from one worksheet to another Anders Excel Discussion (Misc queries) 2 October 25th 06 05:21 PM
Sorting cells: a list behind the cells do not move with the cell Ross M Excel Discussion (Misc queries) 2 September 21st 06 12:14 PM
Macro to move to specified cells, pause for input at each? Pete in Montrose Excel Discussion (Misc queries) 1 March 5th 05 06:18 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"