+ Reply to Thread
Results 1 to 14 of 14

Multiple Comboboxes one click

  1. #1
    Registered User
    Join Date
    08-25-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    44

    Multiple Comboboxes one click

    Hey All,

    I have 2 comboboxes created on a userform.

    This is my code for both of them

    Please Login or Register  to view this content.
    I want to be able to populate combobox2 when I select the combobox1
    so when I click on Advise on Parrs I want 1 to come up in the combobox2

    how do I do this?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Multiple Comboboxes one click

    Hello slim1313,

    The code below will load Combox2 with "1,2,3,4" when the item "Advise on Parrs" is selected in ComboBox1. All code is for the UserForm.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    08-25-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: Multiple Comboboxes one click

    It loads perfect, but I want it to automatically select I dont want to have to go and pick 1,2,3,4 and so on
    is that possible?

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,662

    Re: Multiple Comboboxes one click

    From your description of what you want, it seems that your second box would be a textbox vs. a combobox. If so, then
    Please Login or Register  to view this content.
    otherwise
    Please Login or Register  to view this content.
    Ben Van Johnson

  5. #5
    Registered User
    Join Date
    08-25-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: Multiple Comboboxes one click

    sorry proton Leah that does not work
    see I used 1,2,3,4 as an example, they will have unique numbers that are not in order there has to be a way to be able to populate 2 comboboxes just by selecting 1. or selecting and item in the combobox and having a specific number pop in a textbox

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Multiple Comboboxes one click

    Hello slim1313,

    Where does these numbers come from?

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Multiple Comboboxes one click

    If you want the selections of the two lists linked, would a 2 column combobox work?
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  8. #8
    Registered User
    Join Date
    08-25-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: Multiple Comboboxes one click

    I can do the 2 column combobox, it looks ok, is there any way to populate maybe a textbox with the number associated to the selection

    So I pick Advise on parrs and the number 3 pops in a textbox?
    or I pick Escalation and the number 435 pops in a textbox?

    Leith I have given the selections a number myself, they are not consicutive, so one can be 1 and another can be 75

  9. #9
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Multiple Comboboxes one click

    Quote Originally Posted by slim1313 View Post
    I can do the 2 column combobox, it looks ok, is there any way to populate maybe a textbox with the number associated to the
    Why don't you use 2 listbox?

    When you double click item in list box1 --> it will be moved to listbox2

  10. #10
    Registered User
    Join Date
    08-25-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: Multiple Comboboxes one click

    dont know how to code that with 2 listboxes

  11. #11
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Multiple Comboboxes one click

    Quote Originally Posted by slim1313 View Post
    I can do the 2 column combobox, it looks ok, is there any way to populate maybe a textbox with the number associated to the selection
    I would use a Label rather than a TextBox (the user can't change the list so there is no need for a textBox)
    Please Login or Register  to view this content.

  12. #12
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Multiple Comboboxes one click

    Quote Originally Posted by slim1313 View Post
    dont know how to code that with 2 listboxes
    Please, you can see the code under the link
    http://www.theopensourcery.com/vb12tut.htm

    a good code-exmple to your issue, I think that

  13. #13
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Multiple Comboboxes one click

    I had one other thought. Are the 1,2,3 in this a simplification of the data? Or do you want to link the index of an entry with it's being selected?
    Have you looked at the .ListIndex property of a comboBox?

  14. #14
    Registered User
    Join Date
    08-25-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: Multiple Comboboxes one click

    "I had one other thought. Are the 1,2,3 in this a simplification of the data? Or do you want to link the index of an entry with it's being selected?
    Have you looked at the .ListIndex property of a comboBox? "

    Yes link the index would be great can someone point me in the correct direction with the code?

+ 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