+ Reply to Thread
Results 1 to 5 of 5

UserForms Combobox Vlookup Not Functioning Correctly

  1. #1
    Registered User
    Join Date
    03-29-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    7

    UserForms Combobox Vlookup Not Functioning Correctly

    Hello Everyone,

    Thanks in advance for any assistance you provide!

    I have attached a sample of the workbook I am working on. This is with the information cleaned up and examples shown.

    If you click the "Create Work Order" button on the right side of sheet 1 (Work Order) it will pop up a user form. That works great and you don't need to worry about that.

    The issue comes when trying to enter items. If you press the "Add More Items" button it brings you to a user form for entering item information.

    I have a combobox set up to pull the manufacturers item # if there is a customer item number assigned to it. So, in theory the person doing the data entry will be able to type in or select the customer's item number and it will autopopulate the manufacturers number through a vlookup code. This works great if the customer item # is alpha numerical but doesn't work if the item # is a number. I have tried different formats, etc and it just won't work.

    The other problem is the vlookup to autopopulate the item description won't pull at all.

    This is my first project using userforms and so everything might be a little messy, and maybe I'm making a rooky mistake but I just can't figure it out.

    Hopefully this is enough info with the workbook attached to get some help.

    Here are the codes I have attached to my forms.


    For The Manufacturers Item # to Be Autopopulated
    Please Login or Register  to view this content.

    For The Item Description to Be Autopopulated
    Please Login or Register  to view this content.

    To place the data from the form into the workbook:
    Please Login or Register  to view this content.
    To close the form and hide blank rows:
    Please Login or Register  to view this content.
    Thank you again!!

    Mandy
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: UserForms Combobox Vlookup Not Functioning Correctly

    If you are using a contiguous range to populate the combobox you can use its ListIndex property to determine the row the selected item came from.

    I'd post some code but it's not really clear where the problem lies - I get errors with both the Vlookups.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    03-29-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    7

    Re: UserForms Combobox Vlookup Not Functioning Correctly

    Quote Originally Posted by Norie View Post
    If you are using a contiguous range to populate the combobox you can use its ListIndex property to determine the row the selected item came from.

    I'd post some code but it's not really clear where the problem lies - I get errors with both the Vlookups.
    Thank you for your reply!!

    I'm sorry, I'm not really sure what you mean by your first comment. Are you saying I can look it up based off of the row instead of the item # itself?

    Also, is there a better way to autopopulate the data than to use vlookup? I'm really probably out of my league here.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: UserForms Combobox Vlookup Not Functioning Correctly

    Let's say you've populated a combobox with the range A1:A10 and the user selects the 4th item in the list, ie the value from A4.

    That would mean that the ListIndex of the combobox would be 3, to get the row of the value that's been selected we simply add 1 to the ListIndex.

    Once we have the row we can access all the other values related to the selected item.

    For example to get the value in column B we could use Range("B" & ComboBox1.ListIndex + 1).Value.

    That's kind of a simplification of things but like I said I'm not sure where exactly you are having problems as both VLookUps fail when I try your code.

  5. #5
    Registered User
    Join Date
    03-29-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    7

    Re: UserForms Combobox Vlookup Not Functioning Correctly

    Quote Originally Posted by Norie View Post
    Let's say you've populated a combobox with the range A1:A10 and the user selects the 4th item in the list, ie the value from A4.

    That would mean that the ListIndex of the combobox would be 3, to get the row of the value that's been selected we simply add 1 to the ListIndex.

    Once we have the row we can access all the other values related to the selected item.

    For example to get the value in column B we could use Range("B" & ComboBox1.ListIndex + 1).Value.

    That's kind of a simplification of things but like I said I'm not sure where exactly you are having problems as both VLookUps fail when I try your code.

    It's strange that they fail because the first one works for me.

    I will try to use ListIndex to do what I need to. Thank you very much!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. LOOP not functioning correctly
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2013, 02:03 PM
  2. networkdays not functioning correctly please help
    By jtmayo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-07-2012, 08:27 PM
  3. [SOLVED] IF - Formula Not Functioning Correctly
    By Inez15 in forum Excel General
    Replies: 2
    Last Post: 11-12-2012, 06:51 PM
  4. If Or Statement not functioning correctly
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2012, 08:08 PM
  5. Why isn't this if statement functioning correctly?!?
    By rmar2011 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-29-2011, 07:31 AM
  6. LookUp Function Not Functioning Correctly
    By mycon73 in forum Excel General
    Replies: 3
    Last Post: 07-19-2011, 10:31 AM
  7. Time not functioning correctly
    By moonyboy99 in forum Excel General
    Replies: 4
    Last Post: 07-17-2008, 02:42 AM
  8. AutoComplete not functioning correctly
    By JCLSB in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-24-2006, 03:30 PM

Tags for this Thread

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