+ Reply to Thread
Results 1 to 9 of 9

Modifying Macro

  1. #1
    CLR
    Guest

    RE: Modifying Macro

    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.


  2. #2
    carl
    Guest

    Re: Modifying Macro

    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.

    "Excel_Geek" wrote:

    >
    > Some questions, so I can try to help you...
    >
    > Are ref1, ref2, and ref3, named ranges in the workbook?
    >
    > What is RC[9]?
    >
    >
    > --
    > Excel_Geek
    >
    >
    > ------------------------------------------------------------------------
    > Excel_Geek's Profile: http://www.excelforum.com/member.php...o&userid=26423
    > View this thread: http://www.excelforum.com/showthread...hreadid=399200
    >
    >


  3. #3
    CLR
    Guest

    RE: Modifying Macro

    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.


  4. #4
    carl
    Guest

    Re: Modifying Macro

    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.

    "Excel_Geek" wrote:

    >
    > Some questions, so I can try to help you...
    >
    > Are ref1, ref2, and ref3, named ranges in the workbook?
    >
    > What is RC[9]?
    >
    >
    > --
    > Excel_Geek
    >
    >
    > ------------------------------------------------------------------------
    > Excel_Geek's Profile: http://www.excelforum.com/member.php...o&userid=26423
    > View this thread: http://www.excelforum.com/showthread...hreadid=399200
    >
    >


  5. #5
    CLR
    Guest

    RE: Modifying Macro

    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.


  6. #6
    carl
    Guest

    Re: Modifying Macro

    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.

    "Excel_Geek" wrote:

    >
    > Some questions, so I can try to help you...
    >
    > Are ref1, ref2, and ref3, named ranges in the workbook?
    >
    > What is RC[9]?
    >
    >
    > --
    > Excel_Geek
    >
    >
    > ------------------------------------------------------------------------
    > Excel_Geek's Profile: http://www.excelforum.com/member.php...o&userid=26423
    > View this thread: http://www.excelforum.com/showthread...hreadid=399200
    >
    >


  7. #7
    carl
    Guest

    Modifying Macro

    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.

  8. #8
    CLR
    Guest

    RE: Modifying Macro

    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.


  9. #9
    carl
    Guest

    Re: Modifying Macro

    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.

    "Excel_Geek" wrote:

    >
    > Some questions, so I can try to help you...
    >
    > Are ref1, ref2, and ref3, named ranges in the workbook?
    >
    > What is RC[9]?
    >
    >
    > --
    > Excel_Geek
    >
    >
    > ------------------------------------------------------------------------
    > Excel_Geek's Profile: http://www.excelforum.com/member.php...o&userid=26423
    > View this thread: http://www.excelforum.com/showthread...hreadid=399200
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1