0

I was doing a code for vba and wondering why I received a runtime error 1004 when attempting to paste in sheets "Datasheet". It tells me the information cannot be pasted as the copy area and paste area are not the same size and shape.

Is there anyway to work around this?

If (Not (rowmatched) And k = referencesheetcols) Then
    range2.Copy
    Sheets(referencesheetname).Range("a1:a6000").Cells(p, 1).Offset(2, 0).Select
    ActiveSheet.Paste
    p = p + 1
    Sheets("Datasheet").Activate
    ActiveSheet.Cells(q, 1).Offset(2, 1).Select
    ActiveSheet.Paste
    q = q + 1
End If

Next
End If
Next
  • 1
    You've only pasted part of your code... It's impossible to konw what else is going on. Or did you not mean to paste the last next, end if and next... What is the initial value of p and q - and what is p and q (give them real names). Please edit your question and make it clear, or else it will probably be closed... – Dave Jul 6 '15 at 7:48
  • Also., what is the value of range2? What is k (use real words)? – Dave Jul 6 '15 at 7:57
0

Quick Answer: Resolved using resize for the target cells.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.