+ Reply to Thread
Results 1 to 3 of 3

Application.WorksheetFunction.Match

Hybrid View

  1. #1
    TK
    Guest

    Application.WorksheetFunction.Match

    Is it possible to use a value from one spreadsheet as the lookup value
    and the range from another spreadsheet as the range argument? If so,
    what would the syntax be?

    Thanks

  2. #2
    Dave Peterson
    Guest

    Re: Application.WorksheetFunction.Match

    Both workbooks are open?

    dim myLookup as range
    dim myLookupRng as range
    dim res as variant

    set mylookup = workbooks("book1.xls").worksheets("sheet1").range("a1")
    set mylookuprng = workbooks("book2.xls").worksheets("sheet99").range("a1:A99")

    res = application.match(mylookup.value, mylookuprng,0)

    if iserror(res) then
    msgbox "not found"
    else
    msgbox "Found on row: " & res
    end if

    is one way.


    TK wrote:
    >
    > Is it possible to use a value from one spreadsheet as the lookup value
    > and the range from another spreadsheet as the range argument? If so,
    > what would the syntax be?
    >
    > Thanks


    --

    Dave Peterson

  3. #3
    TK
    Guest

    Re: Application.WorksheetFunction.Match

    Dave Peterson wrote:
    > Both workbooks are open?
    >
    > dim myLookup as range
    > dim myLookupRng as range
    > dim res as variant
    >
    > set mylookup = workbooks("book1.xls").worksheets("sheet1").range("a1")
    > set mylookuprng = workbooks("book2.xls").worksheets("sheet99").range("a1:A99")
    >
    > res = application.match(mylookup.value, mylookuprng,0)
    >
    > if iserror(res) then
    > msgbox "not found"
    > else
    > msgbox "Found on row: " & res
    > end if
    >
    > is one way.
    >
    >
    > TK wrote:
    >
    >>Is it possible to use a value from one spreadsheet as the lookup value
    >>and the range from another spreadsheet as the range argument? If so,
    >>what would the syntax be?
    >>
    >>Thanks

    >
    >

    Works great. Thanks a lot!

+ 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