![]() |
Why it is not pasting it to the correct place?
Hi,
I have a simple code to paste some data which is in "Sheet1" to "Sheet2". ========== Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Paste Destination:=Range("a20") End Sub ======= Although I am clearly defining that it should paste on "Sheet2" it nevertheless pastes on "Sheet1". Any explanation why it does not paste on "Sheet2"? Thanks. |
Why it is not pasting it to the correct place?
Give this a whirl...
Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Range("A20") End Sub -- HTH... Jim Thomlinson "GreenInIowa" wrote: Hi, I have a simple code to paste some data which is in "Sheet1" to "Sheet2". ========== Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Paste Destination:=Range("a20") End Sub ======= Although I am clearly defining that it should paste on "Sheet2" it nevertheless pastes on "Sheet1". Any explanation why it does not paste on "Sheet2"? Thanks. |
Why it is not pasting it to the correct place?
Thanks Jim, it is working. But, I am not quite still sure why the initial one
did not work! "Jim Thomlinson" wrote: Give this a whirl... Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Range("A20") End Sub -- HTH... Jim Thomlinson "GreenInIowa" wrote: Hi, I have a simple code to paste some data which is in "Sheet1" to "Sheet2". ========== Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Paste Destination:=Range("a20") End Sub ======= Although I am clearly defining that it should paste on "Sheet2" it nevertheless pastes on "Sheet1". Any explanation why it does not paste on "Sheet2"? Thanks. |
Why it is not pasting it to the correct place?
you need to reference the sheet, sheet2 in this case, for the paste
operation Copy Worksheets("Sheet2").Range("A20") -- Gary "GreenInIowa" wrote in message ... Thanks Jim, it is working. But, I am not quite still sure why the initial one did not work! "Jim Thomlinson" wrote: Give this a whirl... Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Range("A20") End Sub -- HTH... Jim Thomlinson "GreenInIowa" wrote: Hi, I have a simple code to paste some data which is in "Sheet1" to "Sheet2". ========== Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Paste Destination:=Range("a20") End Sub ======= Although I am clearly defining that it should paste on "Sheet2" it nevertheless pastes on "Sheet1". Any explanation why it does not paste on "Sheet2"? Thanks. |
Why it is not pasting it to the correct place?
Sub test1()
Worksheets("Sheet1").Range("data").Copy With Worksheets("Sheet2") .Paste Destination:=.Range("a20") End With End Sub perhaps. -- Regards, Tom Ogilvy "GreenInIowa" wrote in message ... Hi, I have a simple code to paste some data which is in "Sheet1" to "Sheet2". ========== Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Paste Destination:=Range("a20") End Sub ======= Although I am clearly defining that it should paste on "Sheet2" it nevertheless pastes on "Sheet1". Any explanation why it does not paste on "Sheet2"? Thanks. |
Why it is not pasting it to the correct place?
Thanks Jim, it is working. But, I am not quite still sure why the initial
one did not work! because Worksheets("Sheet2").Paste Destination:=Range("a20") doesn't really specify a sheet for Destination. You may think it is implied, but obviously Excel does not. Without specific instructions, Excel will assume you mean ActiveSheet in regards to the destination (which is Sheet1). The following would work: Worksheets("Sheet2").Paste Destination:=Worksheets("Sheet2").Range("a20") HTH, -- George Nicholson Remove 'Junk' from return address. "GreenInIowa" wrote in message ... Thanks Jim, it is working. But, I am not quite still sure why the initial one did not work! "Jim Thomlinson" wrote: Give this a whirl... Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Range("A20") End Sub -- HTH... Jim Thomlinson "GreenInIowa" wrote: Hi, I have a simple code to paste some data which is in "Sheet1" to "Sheet2". ========== Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Paste Destination:=Range("a20") End Sub ======= Although I am clearly defining that it should paste on "Sheet2" it nevertheless pastes on "Sheet1". Any explanation why it does not paste on "Sheet2"? Thanks. |
Why it is not pasting it to the correct place?
Thank to all. It makes sense to me now!
"Tom Ogilvy" wrote: Sub test1() Worksheets("Sheet1").Range("data").Copy With Worksheets("Sheet2") .Paste Destination:=.Range("a20") End With End Sub perhaps. -- Regards, Tom Ogilvy "GreenInIowa" wrote in message ... Hi, I have a simple code to paste some data which is in "Sheet1" to "Sheet2". ========== Sub test1() Worksheets("Sheet1").Range("data").Copy Worksheets("Sheet2").Paste Destination:=Range("a20") End Sub ======= Although I am clearly defining that it should paste on "Sheet2" it nevertheless pastes on "Sheet1". Any explanation why it does not paste on "Sheet2"? Thanks. |
All times are GMT +1. The time now is 11:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com