Hello
I need to loop through a range from column 27 through 40 and row 3 through 17,694 (dimmed drow) performing a vlookup in every cell using a lookup table with 16 columns.
p=3 'row
tc =3 'column index in vlookup
v = 27 'destination column
For tc = tc to 16
For v = v to 40
p = 3
For p = p to drow
Cells(p, v).Value = Application.VLookup(Cells(p, 1), Workbooks(Book21Name).Worksheets("Sheet").Range("E2:T" & erow), tc, False)
Next p
Next v
Next tc
It works on all rows of column 27 (variable v). but I need the destination column(v) and the column.index (tc) in the vlookup formula to change at the same time.
Help?
I need to loop through a range from column 27 through 40 and row 3 through 17,694 (dimmed drow) performing a vlookup in every cell using a lookup table with 16 columns.
p=3 'row
tc =3 'column index in vlookup
v = 27 'destination column
For tc = tc to 16
For v = v to 40
p = 3
For p = p to drow
Cells(p, v).Value = Application.VLookup(Cells(p, 1), Workbooks(Book21Name).Worksheets("Sheet").Range("E2:T" & erow), tc, False)
Next p
Next v
Next tc
It works on all rows of column 27 (variable v). but I need the destination column(v) and the column.index (tc) in the vlookup formula to change at the same time.
Help?
Last edited: