Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Moving a row

I am trying to move a row from Sheet2 to sheet1. I keep getting an error in
my first attempt:

Sheets("Sheet1").Range("A4:XX4") = Sheets("Sheet2").Range("A1:XX1")

Error code:
Application-defined or object-defined error


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 342
Default Moving a row

Try:

Sheets("Sheet1").Range("A4:XX4") = Sheets("Sheet2").Range("A1:XX1").Value
Or
Sheets("Sheet1").Range("A4:XX4") = Sheets("Sheet2").Range("A1:XX1").Formula
Or
Sheets("sheet2").Range("A1:XX1").Copy Sheets("sheet1").Range("A4")

Tom
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Moving a row

Not sure if you want to use cut or copy, so here are both options:

Sheets("Sheet1").Range("A4:XX4").Cut
Destination:=Sheets("Sheet2").Range("A1")

Sheets("Sheet1").Range("A4:XX4").Copy
Destination:=Sheets("Sheet2").Range("A1")

Regards,
Per

"Philosophaie" skrev i meddelelsen
...
I am trying to move a row from Sheet2 to sheet1. I keep getting an error
in
my first attempt:

Sheets("Sheet1").Range("A4:XX4") = Sheets("Sheet2").Range("A1:XX1")

Error code:
Application-defined or object-defined error


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Moving a row

Sheets("Sheet2").Range("A1:XX1"). Copy Sheets("Sheet1").Range("A4")

Note that this is a copy and not a move.
--
Gary''s Student - gsnu201001
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Moving a row

None of the above worked. The reason I think is because the Range equation
lies within a:
Select Case z
Case 1
Sheets("Sheet1").Range("A4:XX4") = Sheets("Sheet2").Range("A1:XX1")
Case 2
....
End Select

For some reason in a Select Case it gives the error below:

Application-defined or object-defined error.

When I tried:
Sheets("Sheet1").Cells(4,1)=Sheets("Sheet2").Cells (1,1)
It printed out the first cell of Sheet2 with no error, Strange.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 342
Default Moving a row

Did you add the .value or .formula? I found that is necessary to make it
work, but you might be better off using the copy command as that copies
everything about the cell.

Tom
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
Moving text around cells without moving boarder lines Dale Excel Discussion (Misc queries) 1 December 15th 09 06:14 PM
Moving Data between sheets in the same workbook and moving data between Workbooks. Alison Brown Excel Worksheet Functions 0 February 10th 09 01:03 AM
Arrow Keys Moving Window Frame instead of Moving Between Cells nemmex Excel Discussion (Misc queries) 2 April 9th 07 09:08 AM
How to pick one or more items out of a list, moving to new list, moving up or down. (form) Subteam Excel Discussion (Misc queries) 3 February 17th 06 04:13 AM


All times are GMT +1. The time now is 06:21 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"