ExcelNoob222
Board Regular
- Joined
- Jun 17, 2020
- Messages
- 77
- Office Version
- 365
- Platform
- Windows
Hi,
I have a vlookup that currently returns the value in the last column, which happens to be column E currently. So my vlookup is: =VLOOKUP(A2,Data!A:E,5,FALSE)
I have a macro that inserts this formula. However, at some point data will be added to column F and then eventually G and so on. How can I adjust the vba so that the col_index_num automatically changes to the last column of data? So that when data gets added to column F the formula would be =VLOOKUP(A2,Data!A:E,6,FALSE) and then when added to column G it is =VLOOKUP(A2,Data!A:E,7,FALSE)?
Thanks!
I have a vlookup that currently returns the value in the last column, which happens to be column E currently. So my vlookup is: =VLOOKUP(A2,Data!A:E,5,FALSE)
I have a macro that inserts this formula. However, at some point data will be added to column F and then eventually G and so on. How can I adjust the vba so that the col_index_num automatically changes to the last column of data? So that when data gets added to column F the formula would be =VLOOKUP(A2,Data!A:E,6,FALSE) and then when added to column G it is =VLOOKUP(A2,Data!A:E,7,FALSE)?
Thanks!