I'm trying to write a VBA code thta helps me Vlookup value from another location on C Drive, but apparently only the first two cells work.
Could you help me correct this code? Really new to VBA and just trying my waters with the Do While Looops.
Sub Copy3()
Dim lookfor As Range
Dim table_array As Range
Dim table_array_col As Integer
Dim lookFor_col As Integer
Dim Wbk As Workbook
Dim Rows As Integer
Rows = 2
Do While Rows < 60
Set lookfor = Cells(Rows, 1)
Set Wbk = Workbooks.Open("C:\Users\XXX.xlsx")
Set table_array = Wbk.Sheets("Sheet1").Range("B2:H60")
table_array_col = 5
lookFor_col = ThisWorkbook.Sheets("Sheet1").UsedRange.Columns.Count - 2
ThisWorkbook.Sheets("Sheet1").Cells(Rows, lookFor_col).Formula = Application.VLookup(lookfor.Value, table_array, table_array_col, 0)
Rows = Rows + 1
Loop
End Sub