I need to create a VBA VlookUp that will go through Col A to H in a Sheet2 tab(the table_array), match it with column V(look_up value) in Sheet 1 and put the matching results(which is the column index and its in column 7) in cell AD. I was able to test this for a very small range of values, however it doesnt work for my whole datasets. Column V has over 15000 cells! Below is my code so far but it returns an error. Please help
In Excel, this is how the formula looks like: e.g for Cell AF2 ```=VLOOKUP(V2;Sheet2!A:H;7;FALSE)```
Code:
Sub ADDCLM()
Dim table_Row as Long
Dim table_Clm as Long
Table1 = Sheet1.Range("V:V")
Table2 = Sheet2.Range("A:H")
New_Row = Sheet1.Range("AF2").Row
New_Clm = Sheet1.Range("AF2").Column
For Each c1 in Table1
Sheet1.Cells(New_Row, New_Clm) = Application.WorksheetFunction.VLookup(c1, Table2, 7, False)
New_Row = New_Row + 1
Next c1
End Sub
Last edited by a moderator: