I am trying to automate an excel process with vba.
There is a column for each month starting at 2010 (this can extend infinitely, or at least within excel's limit). There are some 500 rows below that with numerical data.
So, I would like to find the last column which isn't used (current month) and populate all of the rows under it from a vlookup.
Thanks.
Working Code!
With ActiveSheet.Range("IV42").End(xlToLeft)
Dim iRow As Integer
For iRow = 1 To 581
Dim Lookup_Value, Table_Array, Col_Index, Range_Lookup As String
Lookup_Value = "B42:B622"
Table_Array = "'Current Rankings'!$B$2:$C$607"
Col_Index = "2"
Range_Lookup = "False"
.Offset(iRow - 1, 0).Formula = "=VLOOKUP(" & Lookup_Value & "," & Table_Array & "," & Col_Index & "," & Range_Lookup & ")"
Next iRow
End With