Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
fig from excel not correct decimal place when merged. In word | Excel Discussion (Misc queries) | |||
can excel auto correct when cutting and pasting | Excel Discussion (Misc queries) | |||
Pasting on Filtered Data Sheets without pasting onto hidden cells | Excel Discussion (Misc queries) | |||
Pasting numbers and formulas without pasting format. | Excel Discussion (Misc queries) | |||
1st, 2nd, 3rd Place etc..... | Excel Worksheet Functions |