Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Copy/Paste Problem: Runtime error 1004

I am copying and pasting some entries (entire rows, one at a time)
from one worksheet (NewDataWS) to another worksheet (ErrorWS) in the
same workbook. This code works fine:

NewDataWS.Cells(i, FirstNameCol).EntireRow.Copy
ErrorWS.Paste Destination:=ErrorWS.Range("A" & ErrorRow)

I want to place another value (not in the source row) in the
destination worksheet for each row, as I process it. However, when I
change the second line to start at Column "B", like below:

ErrorWS.Paste Destination:=ErrorWS.Range("B" & ErrorRow)

I get the following runtime error:

"Runtime error 1004
The information cannot be pasted because the Copy area and the paste
area are not the same size and shape. . . . "

Since I am just specifying the starting cell, I do not understand
why I get this. Do you?

Thanks in advance, Alan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Copy/Paste Problem: Runtime error 1004

I think it could be a couple of things:
http://support.microsoft.com/kb/210684

http://support.microsoft.com/kb/818808

Can you select the destination cell and paste-special-values?
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Thats what I do and I never get the Error 1004 (well almost never).

Are those Named Ranges? I cant seem to recreate what you have, but I would
surmise that the code needs to be something like this:
ErrorWS.PasteSpecial Destination:=ErrorWS.Range("A" & ErrorRow)
ErrorWS.PasteSpecial Destination:=ErrorWS.Range("B" & ErrorRow)
€˜etc.

Ryan---

--
RyGuy


"Alan" wrote:

I am copying and pasting some entries (entire rows, one at a time)
from one worksheet (NewDataWS) to another worksheet (ErrorWS) in the
same workbook. This code works fine:

NewDataWS.Cells(i, FirstNameCol).EntireRow.Copy
ErrorWS.Paste Destination:=ErrorWS.Range("A" & ErrorRow)

I want to place another value (not in the source row) in the
destination worksheet for each row, as I process it. However, when I
change the second line to start at Column "B", like below:

ErrorWS.Paste Destination:=ErrorWS.Range("B" & ErrorRow)

I get the following runtime error:

"Runtime error 1004
The information cannot be pasted because the Copy area and the paste
area are not the same size and shape. . . . "

Since I am just specifying the starting cell, I do not understand
why I get this. Do you?

Thanks in advance, Alan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Copy/Paste Problem: Runtime error 1004

I also thought that copying the entire source row may be a problem
when trying to paste specifically. I tried this but got the same
error:

NewDataWS.Range(Cells(i, 1), Cells(i, ErrorLastColumn)).Copy
ErrorWS.Range(Cells(ErrorRow, 2), Cells(ErrorRow, ErrorLastColumn +
1)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False,
Transpose:=False

I also tried:

NewDataWS.Cells(i, FirstNameCol).EntireRow.Copy
ErrorWS.Cells(ErrorRow, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, _
SkipBlanks:=False,
Transpose:=False

but got "Select method of Range class failed".

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Copy/Paste Problem: Runtime error 1004

I just pasted the entire row, then added a cell:

NewDataWS.Cells(i, FirstNameCol).EntireRow.Copy
ErrorWS.Paste Destination:=ErrorWS.Range("A" & ErrorRow)
With ErrorWS.Cells(ErrorRow, 1)
.Insert Shift:=xlToRight
.Value = Message
End With


ErrorRow is a row counter to keep up with the next open row.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy/Paste Problem: Runtime error 1004


Alan, if you wish you can join our forums (link below) for free, when
posting there you can attach a workbook so we can see your structure,
code etc., if you do join and post please post in this thread (link
shown below) so that people who have been following or helping in the
thread can still continue to do so.

Alan;274115 Wrote:
I just pasted the entire row, then added a cell:

NewDataWS.Cells(i, FirstNameCol).EntireRow.Copy
ErrorWS.Paste Destination:=ErrorWS.Range("A" & ErrorRow)
With ErrorWS.Cells(ErrorRow, 1)
.Insert Shift:=xlToRight
.Value = Message
End With


ErrorRow is a row counter to keep up with the next open row.



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=76369



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy/Paste Problem: Runtime error 1004


It would be good if you could post all of your code, however, try this:

Code:
--------------------
NewDataWS.Cells(i, FirstNameCol).EntireRow.Copy _
Destination:=ErrorWS.Range("B" & ErrorRow)

--------------------
How are you finding ErrorRow?, how are you defining ErrorWs? have you
set ErrorWs to be a name?, these are just some of the many reasons you
should post all of your code :)

Alan;274073 Wrote:
I also thought that copying the entire source row may be a problem
when trying to paste specifically. I tried this but got the same
error:

NewDataWS.Range(Cells(i, 1), Cells(i, ErrorLastColumn)).Copy
ErrorWS.Range(Cells(ErrorRow, 2), Cells(ErrorRow, ErrorLastColumn +
1)).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False,
Transpose:=False

I also tried:

NewDataWS.Cells(i, FirstNameCol).EntireRow.Copy
ErrorWS.Cells(ErrorRow, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, _
SkipBlanks:=False,
Transpose:=False

but got "Select method of Range class failed".



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=76369

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Copy/Paste Problem: Runtime error 1004

On Mar 18, 1:07*am, Alan wrote:
* I am copying and pasting some entries (entire rows, one at a time)
from one worksheet (NewDataWS) to another worksheet (ErrorWS) in the
same workbook. *This code works fine:

* * * * * * NewDataWS.Cells(i, FirstNameCol).EntireRow.Copy
* * * * * * ErrorWS.Paste Destination:=ErrorWS.Range("A" & ErrorRow)

I want to place another value (not in the source row) in the
destination worksheet for each row, as I process it. *However, when I
change the second line to start at Column "B", like below:

* * * * * * ErrorWS.Paste Destination:=ErrorWS.Range("B" & ErrorRow)

I get the following runtime error:

"Runtime error 1004
The information cannot be pasted because the Copy area and the paste
area are not the same size and shape. . . . "

* *Since I am just specifying the starting cell, I do not understand
why I get this. *Do you?

* * Thanks in advance, Alan


Alan,

What version of Excel are you using? I am having similar problems with
2000 but it doesn't seem to happen with 2003
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Copy/Paste Problem: Runtime error 1004

Actually, I ran into this using Excel 2007. Alan
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
JB Bates' Runtime Error 1004 problem Ken Johnson Excel Discussion (Misc queries) 0 December 26th 09 10:32 PM
runtime error '1004' application or object defined error. Please help deej Excel Programming 0 August 1st 07 09:26 AM
Copy paste to another Workbook, Error 1004 Steve[_87_] Excel Programming 7 April 16th 07 05:49 PM
Copy Paste not working from Add-in - Error 1004 Trefor Excel Programming 2 November 13th 05 08:41 AM
runtime error 1004 paste method of worksheet class failed wilsoj Excel Programming 12 August 10th 05 08:20 PM


All times are GMT +1. The time now is 05:26 AM.

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"