+ Reply to Thread
Results 1 to 4 of 4

Perform vlookup using prompt boxes

  1. #1
    Registered User
    Join Date
    03-05-2010
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Perform vlookup using prompt boxes

    I don't know whether this is possible or not, but what i need is to perforn a macro to run a vlookup using prompt boxes.
    I have a list of exchange rates that change on a monthly basis, so i need two prompts, one to enter the lookup value (currency code - GBP EUR USD etc.) and another to enter the month in order to return the correct column from the table.
    Sorry if this doesn't make sense, but in essence i need the macro to perform this below
    vlookup(prompt1 - currency ,ex rate table,prompt 2 - month ,false)

    Thanks

    The Cat
    Last edited by The_Cat; 03-15-2010 at 07:47 AM.

  2. #2
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Perform vlookup using prompt boxes

    Welcome to the boards!

    If you could give an excel example of the inputs and outputs, that would help explain things a bit better.
    Bob
    Click my star if my answer helped you. Mark the thread as [SOLVED] if it has been.

  3. #3
    Registered User
    Join Date
    03-05-2010
    Location
    Nottingham, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Perform vlookup using prompt boxes

    Thanks Blane. I think i have solved it. See below where it returns NUM1 as vlookup value and NUM2 as the column reference


    ActiveCell.Select
    ActiveCell.Offset(0, 1).Activate
    NUM1 = Application.InputBox("Enter Currency Code.", "Three letter code", Type:=2)
    ActiveCell.Formula = NUM1
    ActiveCell.Offset(0, 1).Activate
    NUM2 = Application.InputBox("Enter Month.", "Month", Type:=1)
    ActiveCell.Formula = NUM2
    ActiveCell.Offset(0, -2).Activate
    ActiveCell.Formula = "=+VLOOKUP(RC[1],'[LH ex rates.xls]Sheet1'!C3:C18,RC[2]+1,false)"

  4. #4
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Perform vlookup using prompt boxes

    Looking good! Congrats.

+ 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