Copy range to adjacent or fill right

decadence

Well-known Member
Joined
Oct 9, 2015
Messages
525
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
  5. 2007
Platform
  1. Windows
I am trying to copy cells from column C to column D but not having any luck. I would like to copy the cells C2 to last row and the put them in adjacent column D2 to last row if that makes sense. So far I have this but not sure which way to go, Can someone help

Code:
    Dim lastRow As Long
    lastRow = Range("C" & Rows.Count).End(xlUp).Row
    Range ("D2:D" & lastRow) '.Formula
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
19,343
Office Version
  1. 2021
Platform
  1. Windows
Try this:

Code:
Sub Test()
Application.ScreenUpdating = False
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "C").End(xlUp).Row
Range("C2:C" & Lastrow).Copy Destination:=Range("D2")
Application.ScreenUpdating = True
End Sub
 
Upvote 0

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
19,343
Office Version
  1. 2021
Platform
  1. Windows
Or if you like Offset then use this:

Code:
Sub Offset_Test()
'Offset
Application.ScreenUpdating = False
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "C").End(xlUp).Row
Range("C2:C" & Lastrow).Select
Selection.Copy Destination:=Selection.Offset(, 1)
Application.ScreenUpdating = True
End Sub
 
Upvote 0

decadence

Well-known Member
Joined
Oct 9, 2015
Messages
525
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
  5. 2007
Platform
  1. Windows
Thanks My Answer is This, They both work perfectly but I prefer the first one.
 
Upvote 0

Forum statistics

Threads
1,191,045
Messages
5,984,326
Members
439,882
Latest member
gerdc

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