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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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
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
Thanks My Answer is This, They both work perfectly but I prefer the first one.
 
Upvote 0

Forum statistics

Threads
1,214,379
Messages
6,119,190
Members
448,874
Latest member
Lancelots

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