Posts by explrll

    Thanks for listing all your CROSS POSTS ...


    Thanks also for the Like :thumbup:


    Does it mean the macro is producing the expected result ...???

    Hello,


    Yes, your code did produce the correct results. However, I will use a different solution which was simpler because it only changed 1 line of code

    Code
    Selection.AutoFill Destination:=Cells(2, lu).Resize(Range("B" & Rows.Count).End(xlUp).Row - 1)

    [xpost]

    [/xpost]

    I have a VBA macro that will insert a new column (titled updated col..) to the right of the specified column name. Then I use a VLOOKUP and autofill in the new column with updated values. The column location of the updated column is variable/dynamic. How can I make the autofill function automatically perform in the column range lu or in the adjacent column?

    I tried to write it like this

    Code
    Selection.AutoFill Destination:=Range(Cells(2, Columns(lu).Column) & Range("B" & Rows.Count).End(xlUp).Row)

    My current solution requires manually inputting the column Letter location every time before running the VBA

    Code
    Selection.AutoFill Destination:=Range("M2:M" & Range("B" & Rows.Count).End(xlUp).Row)