Trying to copy a formula down an entire column to the last row of data in an adjacent column
<p>I am a new VBA user, and I am trying to create a VBA code to copy a single Vlookup formula down an entire column to the last row of data in an adjacent column. I don't want to specify a specific range, because I intend to use this macro with multiple different files that have different row ranges, so I am looking for a code that will simply copy down to the last value in an adjacent column. </p>

<p>I have tried looking at other similar questions and answers on this website, but none of the solutions that I have found have been working, and I would really appreciate some help!</p>

<p>Here is my code that I currently have:</p>

<pre><code>' Section5 Macro
        ActiveCell.FormulaR1C1 = _
            "=VLOOKUP(RC[6],'[PERSONAL.XLSB]Task and Sections'!R2C1:R254C2,2,FALSE)"
        Range("C2").Select
        Selection.Copy 'Copy Vlookup Formula

        Dim lastRow As Long
        lastRow = Range("B" &amp; Rows.Count).End(xlUp).Row
        Range("C3").AutoFill destination:=Range("C3:C" &amp; lastRow) 'Specify range for Column C based off of row count in Column B

        Application.CutCopyMode = False
        Selection.Copy
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False 'Paste Vlookup equation down the column
  End Sub
</code></pre>

<p>The formula I want to copy is "=VLOOKUP(RC[6],'[PERSONAL.XLSB]Task and Sections'!R2C1:R254C2,2,FALSE". The column that I want to copy this formula down is column C (in all rows except C1 which is the Header). The column that I want to refer to for row length is the adjacent column B.</p>

<p>Currently I am getting an error that says "Compile error: Named argument not found".</p>

<p>Any help would be greatly appreciated!</p>

<p>Thank you,</p>