Copy Column with Dynamic Range to Another Sheet

HotNumbers

Well-known Member
Joined
Feb 14, 2005
Messages
732
I have searched many prior posts on this subject but i have gotten no ware. I am trying to copy a column that will be dynamic is size from one sheet to another. for example

I currently have 1,200 rows of data in Column D4 on Sheet1 that I need to copy to A1 in Sheet2.

The issue i am having the next time i run the macro Sheet1 data for Column D4 will have more data example 2,500 rows of data.

Any ideas would help narrow down my options.. examples would be great.

Thanks in advance to anyone who replies.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Code:
    Dim Lastrow As Long
    Lastrow = Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Row
    Sheets("Sheet2").Range("A:A").ClearContents
    Sheets("Sheet2").Range("A1:A" & Lastrow - 3).Value = Sheets("Sheet1").Range("D4:D" & Lastrow).Value
 
Upvote 0
Thanks for the quick reply. This is probably the shortest code there could be for something so important.

Thanks again....
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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