+ Reply to Thread
Results 1 to 14 of 14

userform combobox fills from selection on sheet

  1. #1
    Forum Contributor
    Join Date
    05-16-2010
    Location
    glasgow scothland
    MS-Off Ver
    Excel 2007
    Posts
    112

    userform combobox fills from selection on sheet

    Hello all,

    I am stuck trying to fill comboboxs on a user form from what a person selects on the sheet.

    In attached if person picks 5 fruits from the list each combobox will load the 5 choices.
    The fruits are listed in column B while the person will put an X in column C.
    The fruits in B with the X in column C will load in combo box.

    This sounds easy but not for me.

    Please take a look at attached.
    Any help is appreciated.
    Attached Files Attached Files
    Last edited by mdshotgun; 11-27-2011 at 07:22 PM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: userform combobox fills from selection on sheet

    Hi mdshotgun

    Remove the code from open workbook event
    and in the userform add

    Please Login or Register  to view this content.
    and change the showmodlal setting of the userform to false
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: userform combobox fills from selection on sheet

    Hi,

    Put this in the userforms code

    Please Login or Register  to view this content.
    When the userform loads, it will take the values marked with x and put them in each combobox
    Please take time to read the forum rules

  4. #4
    Forum Contributor
    Join Date
    05-16-2010
    Location
    glasgow scothland
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: userform combobox fills from selection on sheet

    wow that is some excellent code from you both.

    Thank you very much.

    Before i mark this as solved.
    Could i ask i last question.
    When the 5 fruits appear in the comboboxes when the person picks apples
    in combo1 could it be done so example apple will now disappear from selection for
    the other comboboxes.
    so when they get to combo5 there will be only i choice left.

    Thanks again for the help.

  5. #5
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: userform combobox fills from selection on sheet

    Yes,

    Put this in the userform code

    Please Login or Register  to view this content.
    Create similar codes for cb2-5

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: userform combobox fills from selection on sheet

    or:
    Please Login or Register  to view this content.



  7. #7
    Forum Contributor
    Join Date
    05-16-2010
    Location
    glasgow scothland
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: userform combobox fills from selection on sheet

    Thanks again for the code and help.

    @snb for some reason your code does'nt work.It just fills the comboboxes with all the fruits.

    @steffen your code is giving an error.

    Thanks anyway for trying.

  8. #8
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: userform combobox fills from selection on sheet

    On which line is it giving an error?

    *EDIT

    By the way, if it's only possible to select a different value in each combobox, why not populate each combobox with a different value, and skip the user selection?
    Last edited by Steffen Thomsen; 11-27-2011 at 07:02 AM.

  9. #9
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: userform combobox fills from selection on sheet

    You could have adapted the code yourself

    Please Login or Register  to view this content.

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: userform combobox fills from selection on sheet

    Try this
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  11. #11
    Forum Contributor
    Join Date
    05-16-2010
    Location
    glasgow scothland
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: userform combobox fills from selection on sheet

    Hello all,

    I would like to thank you all for the replies and help.
    It took me a while to figure out how to use the codes been a learner,
    but eventually i did.

    So thank you all again.

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: userform combobox fills from selection on sheet

    Thanks for the rep. whicc code did you use?
    Last edited by royUK; 11-28-2011 at 02:09 AM.

  13. #13
    Forum Contributor
    Join Date
    05-16-2010
    Location
    glasgow scothland
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: userform combobox fills from selection on sheet

    Roy,

    I can use either pikes or steffens for first part to fill combo's.

    i am using your code for the second part.

    The codes together are not working exactly as i wanted but i will spend sometime trying to figure it out.

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: userform combobox fills from selection on sheet

    I know you cannot use RemovItem if the Combo is populated using RowSource, I'm not sure about List Ptroprty. Hence, I used a Loop to load each combo using AddItem

+ 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