VBA copy paste entire row to last row in a different sheet

ArtyS20

New Member
Joined
Oct 1, 2020
Messages
12
Office Version
  1. 2016
Platform
  1. Windows
Hello:

I need help with the below code. I'm trying to copy/paste rows from "Delimited" to "Output". I want to copy all rows (starting on row 1) to last row (which is a variable number). This will be copied to Output starting on row 2 (row 1 is for headers).

So far I have the below but all it's doing it is copying only the last row to Output - not all rows. Thanks!

Dim Lastrow As Long

Sheets("Delimited").Activate
Lastrow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
ActiveSheet.Range("A" & Lastrow).EntireRow.Copy Destination:=Sheets("Output").Range("A2")
Application.Goto Sheets("Output").Range("A2")
Application.CutCopyMode = False
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try this:
VBA Code:
Sub Copy_Rows()
'Modified 1/26/2022  9:34:43 PM  EST
Application.ScreenUpdating = False
Dim Lastrow As Long
Sheets("Delimited").Activate
Lastrow = Sheets("Delimited").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Delimited").Rows(1).Resize(Lastrow).Copy Sheets("OutPut").Rows(2)
Application.Goto Sheets("Output").Range("A2")
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
Try this:
VBA Code:
Sub Copy_Rows()
'Modified 1/26/2022  9:34:43 PM  EST
Application.ScreenUpdating = False
Dim Lastrow As Long
Sheets("Delimited").Activate
Lastrow = Sheets("Delimited").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Delimited").Rows(1).Resize(Lastrow).Copy Sheets("OutPut").Rows(2)
Application.Goto Sheets("Output").Range("A2")
Application.ScreenUpdating = True
End Sub
thank you so much. It works perfect!
 
Upvote 0

Forum statistics

Threads
1,214,854
Messages
6,121,941
Members
449,056
Latest member
denissimo

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