View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default How to insert VLOOKUP function in VBA?

Hi Norman,
I am sorry, I guess I am complicating things more than they should be ;)
What I need to do is the following: I have already a UserForm that copies
two variables from Sheet1 to position of A2 and B2 in Sheet2. In Sheet2, C3,
I need to place a VLOOKUP formula so it reads cell B2 as dynamic table_array.
Since the 1st UserForm every time executes CommandButton it copies different
value. For instance, it may come as "TOTAL_POPULATION" (this has to be an
table_array, pre-determined in Sheet3 and broke according to years) and the
second variable as "Cherokee, KS". The function has to find "Cherokee, KS" in
"TOTAL_POPULATION" table_array which is already in Sheet3 and return value
for 2000 year (that would be =VLOOKUP(A2, B2, 2, FALSE)). The reason I wanted
to use UserForm, by inserting formula, it copies it as and "B2" and not the
table_array. And there are about 20 table_arrays, so, that the 1st UserForm
is used, a user has an option of selecting any other than "TOTATL_POPULATION"
and so one. I hope that makes senss.