+ Reply to Thread
Results 1 to 14 of 14

Populating Combobox based on Combobox selection from EXCEL worksheet

  1. #1
    Registered User
    Join Date
    03-05-2013
    Location
    Wichita, KS, USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Populating Combobox based on Combobox selection from EXCEL worksheet

    Hi all, I'm trying to do some userform developement with multiple dependent comboxes, but I am having trouble populating the third and last combobox. First, I populate the 1st combobox on the userform initialization. I can get the first 2 comboboxes to populate correctly, but I can't seem to get the 3rd combobox to populate correctly.

    The 3rd combobox takes the selection from the 2nd combobox and searches column "A" in the worksheet "Chassis Specs" and populates the 3rd combobox with data from column "B", there will be repeat items in column "A", but all those occurances should populate the 3rd combobox with the data from "B".

    I am attaching my whole workbook.

    Any help would be appreciated.

    Chassis Specs Info_Build_REV B.xlsm

  2. #2
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Hi JChaney17

    Modify your Change Event Code to this
    Please Login or Register  to view this content.
    John

    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.

  3. #3
    Registered User
    Join Date
    03-05-2013
    Location
    Wichita, KS, USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Thank you sir. That worked perfectly.

  4. #4
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Registered User
    Join Date
    03-05-2013
    Location
    Wichita, KS, USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Found one thing that it's kicking back an Run-time error "13" is when I choose "NHRA" --> "NHRA" comboboxes, and when I run Debug it's highlighting the following line:

    For i = LBound(v) To UBound(v)

    Any suggestions?

  6. #6
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Hi JChaney17

    You get the error 'cause it's not an array...try this
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-05-2013
    Location
    Wichita, KS, USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Much better, was having a hard time working through that code.

  8. #8
    Registered User
    Join Date
    03-05-2013
    Location
    Wichita, KS, USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    That works great, what would I need to add to the code to reset the "Chassis Spec" combobox if I choose another type or sub-type selection in the first 2 comboboxes? When I do change the types or sub-types, it just keeps adding to the chassis specs.

    Thanks,

    James

  9. #9
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Hi James

    Well, now, you're really getting into it.

    In ANY General Module place this Code at the very top
    Please Login or Register  to view this content.
    In the ComboBoxChassisSpec_Change Code add the indicated line
    Please Login or Register  to view this content.
    In the ComboBoxChassisSubType_Change Code add the indicated lines
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-05-2013
    Location
    Wichita, KS, USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Awesome John, that fixed everything. Thanks for the help!!

    James

  11. #11
    Registered User
    Join Date
    03-05-2013
    Location
    Wichita, KS, USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    One thing that I am noticing, is that when I go from say Dragster in the first combobox and choose the 2nd combobox and 3rd combobox and get what I want, then I go to the NHRA chassis type on the 1st combobox, and then choose the sub-type, it lists not only the NHRA sub-type, but the dragster sub-types. I tried pretty much all the combinations, and if I go back and choose the NHRA path, it lists the previoous sub-types. Did I miss place something?

  12. #12
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Hi James

    I'm aware of that. I was hoping you'd attempt to make the same changes to ComboBox1 as I made to ComboBox2. Do you wish to try or should I make the changes?

  13. #13
    Registered User
    Join Date
    03-05-2013
    Location
    Wichita, KS, USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Ah...gotcha, no, let me see if I can get that to work. Thanks.

  14. #14
    Registered User
    Join Date
    03-05-2013
    Location
    Wichita, KS, USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    John,

    OK, after I added the code to the Combobox1 and changed it appropriately, I am getting a run-time error 1004(No cells were found") error. When I debug the code, it stops at the following line:

    Run-time Error 1004.jpg

    Here's what I have so for.

    Chassis Specs Info_Build_REV B.xlsm

    Thanks,

    James

  15. #15
    Forum Guru jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Populating Combobox based on Combobox selection from EXCEL worksheet

    Hi James

    Add the two lines of Code as indicated
    Please Login or Register  to view this content.
    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)

Similar Threads

  1. Userform Combobox to populate based on selection in another combobox
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2014, 03:34 PM
  2. [SOLVED] Pre populating a userform from excel based on combobox selection
    By michelle 1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2013, 12:09 PM
  3. Removing Duplicates from ComboBox and Populating one combobox based on another
    By kbmtech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2010, 11:17 PM
  4. Populating the list in a combobox based off the value chosen in another combobox
    By Mervil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2010, 11:50 AM
  5. Populating a userform based on a combobox selection
    By blindzero678 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2010, 03:37 PM

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