I use this formula in my macro:
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[9],ref1,2,FALSE)"
Is it possible to add code that will do the lookup in "ref1" and "ref2" ?
Thank you in advance.
I use this formula in my macro:
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[9],ref1,2,FALSE)"
Is it possible to add code that will do the lookup in "ref1" and "ref2" ?
Thank you in advance.
VLOOKUP will stop when it finds a match, so I you have the same value in both
ranges it will only find the first.......however, you might consider wrapping
your VLOOKUP in an IF(ISNA..... formula so that if it does NOT find the
lookup value in the first range, then it will look in the second
range.......either that, or use two VLOOKUP formulas, one for each range.....
Vaya con Dios,
Chuck, CABGx3
"carl" wrote:
> I use this formula in my macro:
>
>
> ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[9],ref1,2,FALSE)"
>
> Is it possible to add code that will do the lookup in "ref1" and "ref2" ?
>
> Thank you in advance.
VLOOKUP will stop when it finds a match, so I you have the same value in both
ranges it will only find the first.......however, you might consider wrapping
your VLOOKUP in an IF(ISNA..... formula so that if it does NOT find the
lookup value in the first range, then it will look in the second
range.......either that, or use two VLOOKUP formulas, one for each range.....
Vaya con Dios,
Chuck, CABGx3
"carl" wrote:
> I use this formula in my macro:
>
>
> ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[9],ref1,2,FALSE)"
>
> Is it possible to add code that will do the lookup in "ref1" and "ref2" ?
>
> Thank you in advance.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks