+ Reply to Thread
Results 1 to 6 of 6

Select Combobox and populate Listbox

  1. #1
    Registered User
    Join Date
    06-24-2012
    Location
    Portugal
    MS-Off Ver
    Excel 2003, 2007
    Posts
    6

    Select Combobox and populate Listbox

    Hello guys,

    I am working on a inventory table and I am just a newbie on vba.

    So what I am looking for is:

    I want to select the description of the product on a combobox and I want it to populate a listbox showing automatically for example: part code / category of it .
    What is important for me is that the listbox returns the exact match reading the actual database. I don't want to change the structure.

    It is true that there is a lot of information about this on this great site and others but unfortunately I tried several code but did not managed to get it working.

    you can see the file enclosed.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Select Combobox and populate Listbox

    Hi

    I have added the code for you.

    You need to add code to show and hide the lis tbox as you wish.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    06-24-2012
    Location
    Portugal
    MS-Off Ver
    Excel 2003, 2007
    Posts
    6

    Re: Select Combobox and populate Listbox

    Hello mehmetcik,

    Thanks for your help.

    Well it is displaying all the info relative to the description, but it shows all together on Listbox.

    I would prefer a way I could put it on separate textboxes. Because at the end the porpose when clicking OK button will copy it for each place on excel sheet.

    The fact is that I'm really nooob and I was not able to change your code to do it as above.

    In case you could give a hand I would appreciate it.

    Thanks

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Select Combobox and populate Listbox

    Hi

    Clicking Ok will now read the information from the Listbox and write it to your spreadsheet.

    There is no need to mess about with Text Boxes.

    As you are not going to change any of the data, this is a neater solution.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-24-2012
    Location
    Portugal
    MS-Off Ver
    Excel 2003, 2007
    Posts
    6

    Re: Select Combobox and populate Listbox

    Hi Mehmetcik,

    Thanks for helping.

    But the file was already copying information to the spreadsheet, no need to do that.

    The only thing I really need is to show the exact info on listbox or texbox, ex: part code or category according to the product selected on combobox.

    Please do not think on the example I am sending, this is only an example to explain what I need.

    I really thank you for the help you are giving and hope you can come up with a solution.

    Thanks.

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Select Combobox and populate Listbox

    Quote Originally Posted by kapoeira View Post
    I want to select the description of the product on a combobox and I want it to populate a listbox showing automatically for example: part code / category of it .
    What is important for me is that the listbox returns the exact match reading the actual database. I don't want to change the structure.

    ....you can see the file enclosed.

    Thanks in advance.
    mehmetcik provided a very good solution for what you asked, see post #2!

    then you change your mind

    Quote Originally Posted by kapoeira View Post
    The only thing I really need is to show the exact info on listbox or texbox, ex: part code or category according to the product selected on combobox.

    Please do not think on the example I am sending, this is only an example to explain what I need.

    I really thank you for the help you are giving and hope you can come up with a solution.

    Thanks.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

+ 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. [SOLVED] UserForm - Populate Combobox/Listbox with lookup formulas
    By macenmin in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-30-2013, 09:24 AM
  2. [SOLVED] Automatically Populate Listbox from ComboBox Selection
    By doglover in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2013, 01:51 AM
  3. [SOLVED] Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 04:50 PM
  4. In UserForm, how to populate a ComboBox/ListBox with a Range, defined by....
    By johnw993 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-07-2012, 11:06 PM
  5. ComboBox to Populate ListBox
    By Jamie0691 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-15-2012, 08:28 AM

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