+ Reply to Thread
Results 1 to 6 of 6

Lookup Function

  1. #1
    Registered User
    Join Date
    09-13-2012
    Location
    Utah, USA
    MS-Off Ver
    Excel 2007
    Posts
    35

    Lookup Function

    Now that I know where all the best minds on earth are (this site) Im going to do everything I can to learn all I can!
    That being said, is it possible to run a function in a macro that will do a lookup?
    For example instead of writing a VLOOKUP string in the actual excel sheet can I have the lookup called and performed within the macro itself and have it return a value from an array within the excel sheet?

    Im a real novice where it comes to functions so....

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Lookup Function

    phalcon45,

    Yes you can, check out Application.WorksheetFunction
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    09-13-2012
    Location
    Utah, USA
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Lookup Function

    Tried to reply but it didnt go through...so here goes again.
    OK sounds good. Im just not sure how to put the function into my code.
    Right now I have a form that shows me a list of descriptions from a list then the sub sets the value of cell F2 to whatever I select. Then the adjacent cells run VLOOKUP to find the product code and the product price from the array in V2:AA604.
    How do I build the function so that I can run it and return the lookup value?
    Thanks a thousand times over to everyone

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Lookup Function

    Without seeing your code its difficult to give accurate information, but it should look something like this:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-13-2012
    Location
    Utah, USA
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Lookup Function

    Worked PERFECT! Thank you. I had something very similar but I had the syntax wrong in the Vlookup function.
    You guys are a lifesaver.

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Lookup Function

    You're very welcome

    If that takes care of your need, please mark this thread as solved.
    How to mark a thread Solved
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix"
    Change to "Solved"
    Click Save

+ 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