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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default 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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default 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.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default 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.





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
fig from excel not correct decimal place when merged. In word eddieba Excel Discussion (Misc queries) 1 July 14th 09 12:54 PM
can excel auto correct when cutting and pasting bsmile29 Excel Discussion (Misc queries) 5 June 21st 06 09:06 PM
Pasting on Filtered Data Sheets without pasting onto hidden cells CCSMCA Excel Discussion (Misc queries) 1 August 28th 05 01:22 PM
Pasting numbers and formulas without pasting format. Dan Excel Discussion (Misc queries) 3 March 27th 05 03:47 AM
1st, 2nd, 3rd Place etc..... JohnT Excel Worksheet Functions 7 January 9th 05 12:41 PM


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

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

About Us

"It's about Microsoft Excel"