Copy and paste entire rows

Nelson78

Well-known Member
Joined
Sep 11, 2017
Messages
526
Office Version
  1. 2007
Hello everybody.

I need to copy and paste all the rows from sheet Two to sheet One (beginning from the first empty row).
At the moment, the copy and paste works for only one row.

Where is the mistake?

Thank's.

Code:
Sub transfer()

Dim lr As Long, lr2 As Long, r As Long

lr = Sheets("Two").Cells(Rows.Count, "A").End(xlUp).Row
lr2 = Sheets("One").Cells(Rows.Count, "A").End(xlUp).Row

For r = lr To 2 Step -1

Rows(r).Copy Destination:=Sheets("One").Range("A" & lr2 + 1)

Next r

End Sub
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Ok try changing the line:

Code:
If .SpecialCells(xlCellTypeVisible).Count > 2 Then

to

Code:
If .SpecialCells(xlCellTypeVisible).Rows.Count > 1 Then
 
Upvote 0

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top