Are you trying to populate a single cell with an answer each time you run the code or are you trying to populate a cell or group of cells with a VLOOKUP formula and get the code to set the VLOOKUP parameters?
I am trying to get the code to set the VLOOKUP parameters. The number of lines in the lookup table will increase. My concern is if I fix a table range, I will have to go back to change the code every time i increase a row in the lookup table. so I want the program to be a bit more intelligent in that the range defined for the table array will change according to the change in the number of rows. Do you have any idea how i should do this?
Have4 you tried using range names, no code required?
I tried. I set a range name such that it contains a variable but apparently it doesn't work.
I did something like this:
Set tablerange = range (cells(1 , 1), cells(A,2))
where A is the variable for the no of rows.