Reputation: 1449
I am trying to copy and paste some values between worksheets using VBA. I don't see anything inherently wrong with my code but I keep getting the above error.
Set fullCopyRange = ws.Range(Cells(2, 2), Cells(lastRowRow + 1, 8))
fullCopyRange.Copy_ Destination:=Sheets("Requirements").Range(Cells(pasteDestinationLastRowRow + 1, 2))
The first line executes fine, the second does not. pasteDestinationLastRowRow
, I can check beforehand, does indeed have a non empty value, and yet this still returns an error and I have no idea why.
Upvotes: 0
Views: 30
Reputation: 96753
Replace your lines as follows:
Set fullCopyRange = Range(ws.Cells(2, 2), ws.Cells(lastRowRow + 1, 8))
fullCopyRange.Copy Destination:=Sheets("Requirements").Cells(pasteDestinationLastRowRow + 1, 2)
and try again.
We qualify the Cells()
in the first line and fix the syntax in the second.
Upvotes: 1