Copy last populated cell of column A to the next empty cell below to the last row of E

ahuang3433

New Member
Joined
Jan 24, 2017
Messages
35
Hi,

I am trying to achieve the following.

- Copy last populated Cell of each of the designated columns and paste up until the last populated row based on Column E referencing.

Current State:

It paste over everything.

VBA Code:
'Copy Data Down (Columns A:D,F:J, & L)

    Dim lastRow2 As Long
    lastRow2 = Range("E" & Rows.Count).End(xlUp).Row
    Range("A1").End(xlDown).Copy Destination:=Range("A2:A" & lastRow2).Offset(1, 0)
    Range("B1").End(xlDown).Copy Destination:=Range("B2:B" & lastRow2).Offset(1, 0)
    Range("C1").End(xlDown).Copy Destination:=Range("C2:C" & lastRow2).Offset(1, 0)
    Range("D1").End(xlDown).Copy Destination:=Range("D2:D" & lastRow2).Offset(1, 0)
    Range("F1").End(xlDown).Copy Destination:=Range("F2:F" & lastRow2).Offset(1, 0)
    Range("G1").End(xlDown).Copy Destination:=Range("G2:G" & lastRow2).Offset(1, 0)
    Range("H1").End(xlDown).Copy Destination:=Range("H2:H" & lastRow2).Offset(1, 0)
    Range("I1").End(xlDown).Copy Destination:=Range("I2:I" & lastRow2).Offset(1, 0)
    Range("J1").End(xlDown).Copy Destination:=Range("J2:J" & lastRow2).Offset(1, 0)
    Range("L1").End(xlDown).Copy Destination:=Range("L2:L" & lastRow2).Offset(1, 0)
    Range("O1").End(xlDown).Copy Destination:=Range("O2:O" & lastRow2).Offset(1, 0)
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,499
Office Version
  1. 365
Platform
  1. Windows
What is the name of the Sheet where your data resides?
What is the name of the module where you have placed this code?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,144,278
Messages
5,723,465
Members
422,498
Latest member
KAT112014

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