Link to home
Create AccountLog in
Avatar of RWayneH
RWayneHFlag for United States of America

asked on

Copy Data down columns to match number of rows added

Attached is a s-sheet, that we use as a templete.  We add different number of rows to column H, but then we have to manually copy down the sequence in column A and column F, when make sure that column G is copied down to however many rows were added in H.  So the macro to do this for us needs to be dynamic.

I need some help automating this... because we can do this tons of time a day.
Let me know if you have further questions? Thanks. -R-
Sample1.xlsm
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Like this?
Sub FillData()
    Dim lngLastRow As Long
    With Sheets("Order Line Items")
        lngLastRow = .Cells(.Rows.Count, "H").End(xlUp).Row
        .Range("A2").AutoFill .Range("A2:A" & lngLastRow), xlFillSeries
        .Range("F2").AutoFill .Range("F2:F" & lngLastRow), xlFillSeries
        .Range("G2").AutoFill .Range("G2:G" & lngLastRow), xlFillCopy
    End With
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of RWayneH

ASKER

Thanks!!  EXCELent!!  -R-