Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hope I've understood your question properly</p> <p>The following will autofill range <code>Q2:QN</code> where N is the last used cell in column Q</p> <pre><code>Selection.AutoFill Destination:=Range(Range("K2"),Range("K2").End(xlDown)).Offset(ColumnOffset:=6), Type:=xlFillDefault </code></pre> <p>You could also do it the other way round as you have a fixed maximum.</p> <pre><code>Selection.AutoFill Destination:=Range(Range("K2"),Range("K301").End(xlUp)).Offset(ColumnOffset:=6), Type:=xlFillDefault </code></pre> <p>The first looks down the sheet for the last row, and the 2nd looks up the sheet from the maximum to the last row.</p> <p>You can replace Q with whatever column you need, as you appear do do the same for lots of columns!</p> <p><strong>Update</strong></p> <p>I've updated the example, it now finds the used range in the K column and offsets it to your desired column. The value of <code>ColumnOffset</code> will be the same (although positive) as the value used in your <code>R1C1</code> formulas.</p> <p>Also, as the K Range should remain constant, and your formulas are fairly predictable you could shorten it a little. like the following (i've not testing it, just playing around)</p> <pre><code>Sub Vlookup() ' might want to re-name, to avoid confusion with the worksheet function Dim R As Range Dim A As Range Dim I As Integer Set R = Range(Range("K2"), Range("K301").End(xlUp)) Set A = Range("K2") For I = 6 To 9 A.Offset(ColumnOffset:=I).FormulaR1C1 = "=VLOOKUP(RC[-" &amp; CStr(I) &amp; "], table, " &amp; CStr(I+9) &amp; ", FALSE)" A.Offset(ColumnOffset:=I).AutoFill Destination:=R.Offset(I), Type:=xlFillDefault Next I End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload