Filldown Value to the Bottom of a Range

It can be quite useful to generate Excel formula on the fly and copy the formula down to the bottom of the adjacent column.  This is usually beneficial when a download of data has occurred and the data needs to be queried in some way.

Below is a simple Excel vlookup formula which is placed into Cell H2 and the code copies the formula down to the bottom of the range.  What guides the bottom of the range is the reference to the 7th column in the second line of VBA code.

Sub FillTable() 'Excel VBA to filldown a range from top to bottom.
Range("H2").Value="=VLOOKUP(G2,$A$2:$B$17,2,0)"
Range("H2:H" & Cells(Rows.Count, 7).End(xlUp).Row).FillDown
End Sub

Range("H2:H" & Cells(Rows.Count, 7).End(xlUp).Row).FillDown

The above line effectively says drag the formula to the bottom of the range but base the bottom of the range on Column G which is the 7th Column. 

The following VBA procedure will do the same thing as the above with the filldown coding slightly presented differently.

Sub FillTable2() 'Excel VBA to filldown a range from top to bottom
Range("H2").Value="=VLOOKUP(G2,$A$2:$B$17,2,0)"
Range("H3:H" & Cells(Rows.Count, 7).End(xlUp).Row).FormulaR1C1=Range("Ad2").FormulaR1C1
End Sub

The following Excel file shows both VBA procedures.