How a range copy to row2?

techissue2008

Board Regular
Joined
Jun 13, 2008
Messages
80
Hi

This not works:
Code:
Sheets("Sheet2").Range("A2:A").Value = Sheets("Sheet1").Range("D:D").Value

This works:
Code:
Sheets("Sheet2").Range("A:A").Value = Sheets("Sheet1").Range("D:D").Value

How should I make the range copied to and started from A2?

Thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Mike Blackman

Well-known Member
Joined
Jun 8, 2007
Messages
2,494
HI,

One way is;

Code:
Dim lRow As Long

lRow = Range("D" & Rows.Count).End(xlUp).Row

Sheets("Sheet2").Range("A2:A" & lRow).Value = Sheets("Sheet1").Range("D2:D" & lRow).Value
 

techissue2008

Board Regular
Joined
Jun 13, 2008
Messages
80
Hi

Code:
Dim lRow As Long
lRow = Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).row
Sheets("Sheet2").Range("A2:A" & lRow).Value = Sheets("Sheet1").Range("D2:D" & lRow).Value

It has error.
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Sheets("Sheet2").Range("A2:A").Value = Sheets("Sheet1").Range("D:D").Value

That does not work because:
1. you did not specify an End Row in the Sheet2 column A.
2. You were trying to put the ENTIRE column from Sheet1 onto Row2 of shee2.
It won't fit, because from Row2 to the end of sheet2 is 65335 rows,
the entire column from sheet 2 is 65536 rows.

Try

LR = Sheets("Sheet1").Range("D" & Rows.Count).End(xlup).row
Sheets("Sheet1").Range("D1:D" & LR).Copy Sheets("Sheet2").Range("A2")
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,624
Messages
5,838,423
Members
430,546
Latest member
CometOz

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
Top