From: Philosophaie on
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


From: tompl on
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
From: Per Jessen on
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" <Philosophaie(a)discussions.microsoft.com> skrev i meddelelsen
news:4A02356F-EDB7-4C22-85F4-4175E706AFF7(a)microsoft.com...
> 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
>
>
From: Gary''s Student on
Sheets("Sheet2").Range("A1:XX1"). Copy Sheets("Sheet1").Range("A4")

Note that this is a copy and not a move.
--
Gary''s Student - gsnu201001
From: Philosophaie on
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.