Modifying Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Some questions, so I can try to help you...

Are ref1, ref2, and ref3, named ranges in the workbook?

What is RC[9]
 
Hi. Thank you for your help. The ref1 and ref2 are named ranges in the
workbook.

The RC[9] comes from the vba code - not sure what it is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top