VBA to select and copy column to last row

Finalfight40

Active Member
Joined
Apr 24, 2018
Messages
273
Office Version
  1. 365
Platform
  1. Windows
Hi All

I am trying to create a macro but i am stuck with what i am assuming is a line or 2 of code. I have tried to google this but cant find exactly what i am looking for.

I am having a problem where i need to select and copy the data from cell A3 to the last row, in this case to A8. However there may be 5 entries or 1000 entries which i need to select.

Any help here is much appreciated.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]NAME[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Alex[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Bob[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Jessy[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Ben[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Joe[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Elliot[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
This will copy from A3 to the last row in column A.
Code:
Range("A3", Range("A" & Rows.Count).End(xlUp)).Copy
 
Upvote 0
Try this:
Code:
Sub Test()
'Modified 5/8/2018 7:03 AM  EDT
Application.ScreenUpdating = False
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A3:A" & Lastrow).Copy
Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Try this:
Code:
Sub Test()
'Modified 5/8/2018 7:03 AM  EDT
Application.ScreenUpdating = False
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A3:A" & Lastrow).Copy
Application.ScreenUpdating = True
End Sub

Also works very well thank you :)

Can i just ask if there would be a benefit to using one code over the other here?
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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