+ Reply to Thread
Results 1 to 8 of 8

VBA userform vlookup formula

  1. #1
    Forum Contributor
    Join Date
    02-22-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    108

    VBA userform vlookup formula

    Hi

    I have a userform where i have a combobox which has a drop down list that is coded with a dynamic named range and the user should select one off the numbers.

    Next to the combobox i have a textbox which i want the userform to look for the number and return the value of the number?

    I'm sure it is possible and it should be on a combobox exit event however i don't know how to do the formula?

    Please help?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    What exactly have you populated the combobox with?

    If it's a contiguous range with unique values then you can use the combobox"s ListIndex property to find the row the selected item is from.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    02-22-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: VBA userform vlookup formula

    Norie,

    Can you help me with a code?

    This is what i have in my sheet where the comdbox select the number from and then the text was display in the txtbox
    A B
    601 Tire Change
    602 Re-Torque
    603 Pressure
    604 Mechanical

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    It's still not clear how exactly you are populating the combobox.

    I know you are using a named range but what is that named range?

    Anyway, based on the data you posted this might work.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-22-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: VBA userform vlookup formula

    Norie

    Sorry for the inconvenience caused the named range is BDCode and that is only for the numbers 601-604

    So the text box need to look for the value next to the cell 601-604?

    Hope that explains it better

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Did you try the code I posted?

  7. #7
    Forum Contributor
    Join Date
    02-22-2011
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: VBA userform vlookup formula

    Yes I did, and nothing happens when i enter data in the combobox??

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Try this.
    Please Login or Register  to view this content.

+ 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