Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
markline
 
Posts: n/a
Default Method 'Paste' of object '_Worksheet' failed


I keep getting a method paste of object _Worksheet failed error on my
ActiveSheet.Paste command in the code below:

Public Sub CopyRows()
Sheets("Sheet2").Select
' Find the last row of data
FinalRow = Range("A65536").End(xlUp).Row
' Loop through each row
For x = 34 To FinalRow
' Decide if to copy based on column A
ThisValue = Range("A" & x).Value
If ThisValue 0 Then
Range("A" & x & ",B" & x).Copy

Sheets("Sheet3").Select
NextRow = Range("B65536").End(xlUp).Row + 1
Range("B" & NextRow).Select
ActiveSheet.Paste


Sheets("Sheet2").Select
End If
Next x
End Sub

Can anyone help?


--
markline
------------------------------------------------------------------------
markline's Profile: http://www.excelforum.com/member.php...o&userid=23681
View this thread: http://www.excelforum.com/showthread...hreadid=374455

  #2   Report Post  
mangesh_yadav
 
Posts: n/a
Default


Use ActiveSheet.PasteSpecial

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=374455

  #3   Report Post  
markline
 
Posts: n/a
Default


mangesh_yadav Wrote:
Use ActiveSheet.PasteSpecial

Mangesh

I get the same error, but now it's method pastespecial


--
markline
------------------------------------------------------------------------
markline's Profile: http://www.excelforum.com/member.php...o&userid=23681
View this thread: http://www.excelforum.com/showthread...hreadid=374455

  #4   Report Post  
mangesh_yadav
 
Posts: n/a
Default


I had not tried your earlier code, but now after trying it, I find that
it is working fine without any errors. (i.e. by using .Paste)

Can you tell which line is higlighted when you get the error.

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=374455

  #5   Report Post  
markline
 
Posts: n/a
Default


mangesh_yadav Wrote:
I had not tried your earlier code, but now after trying it, I find that
it is working fine without any errors. (i.e. by using .Paste)

Can you tell which line is higlighted when you get the error.

Mangesh

ActiveSheet.Paste is where I'm getting the error

When I do it in a cleen workbook, I don't get any errors either - it's
only happening in the workbook where all of my data is

I'm starting to think the workbook is somehow corrupted, but I don't
really know what to look for to fix it


--
markline
------------------------------------------------------------------------
markline's Profile: http://www.excelforum.com/member.php...o&userid=23681
View this thread: http://www.excelforum.com/showthread...hreadid=374455



  #6   Report Post  
mangesh_yadav
 
Posts: n/a
Default


What is the kind of data you have in this particular sheet. Is this the
only code that you have. And do you have "Sheet3" in your workbook.
After the error, which is the sheet that is displayed. Is it
Sheet3...?

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=374455

  #7   Report Post  
markline
 
Posts: n/a
Default


mangesh_yadav Wrote:
What is the kind of data you have in this particular sheet. Is this the
only code that you have. And do you have "Sheet3" in your workbook.
After the error, which is the sheet that is displayed. Is it
Sheet3...?

Mangesh

The data is nothing special, some general data, some text, some numbers
- but it has been copied between various workbooks a few times before it
wound up in my hands (which leads me to believe the data could be
corrupted)

Yes there is a Sheet3, it successfully pastes into the first cell
before it errors. I also checked the clipboard, and it successfully
copies all of the data out of Sheet2


--
markline
------------------------------------------------------------------------
markline's Profile: http://www.excelforum.com/member.php...o&userid=23681
View this thread: http://www.excelforum.com/showthread...hreadid=374455

  #8   Report Post  
mangesh_yadav
 
Posts: n/a
Default


What is the number of rows that you need to copy. Also it could be
possible that you are going out of the sheet range and thats where it
is failing to paste. Maybe you could send me your worksheet and I'll
have a look at it. send it to
Don't forget to remove the text remove this from the email id.

Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile:
http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=374455

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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Can't Copy and Paste between Excel 2003 Workbooks wllee Excel Discussion (Misc queries) 6 March 30th 05 02:59 PM
VBA: Where to find Excel Object model? N. Foldager Excel Discussion (Misc queries) 13 February 6th 05 06:43 PM
excel - numbers as text Thuferhawat New Users to Excel 12 January 24th 05 09:29 PM


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