Error if only one row to copy and paste to another sheet VBA

Bryan123

New Member
Joined
May 23, 2019
Messages
41
Hi,
I have a VBA here that would copy data from one sheet and paste it to the next empty row in another sheet. However, i keep getting error message if there's only 1 row to be copied and pasted to the sheet. Here is my code:
Sheets("Bryan").Select
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy

Sheets("Q4").Select
Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
ActiveWindow.ScrollColumn = 1
Range("A53").Select
ActiveSheet.Paste
Range("H63").Select


Error:
Run-time error 1004
the information cannot be pasted because the copy area and the paste area are not the same size and shape
 

MARK858

Well-known Member
Joined
Nov 12, 2010
Messages
11,312
Office Version
365, 2010
Platform
Windows, Mobile
Does the below do what you want?

Code:
Sheets("Bryan").Range("A2").CurrentRegion.Copy
Sheets("Q4").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
 

Forum statistics

Threads
1,077,856
Messages
5,336,800
Members
399,103
Latest member
PX04

Some videos you may like

This Week's Hot Topics

Top