Copy/Paste Problem: Runtime error 1004

A

Alan

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
 
R

ryguy7272

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

That’s what I do and I never get the Error 1004 (well almost never).

Are those Named Ranges? I can’t 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---
 
A

Alan

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".
 
A

Alan

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.
 
A

Alan

  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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top