+ Reply to Thread
Results 1 to 15 of 15

Unique items in combobox on userform

Hybrid View

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Unique items in combobox on userform

    Hello everybody
    I have in my attachment Data sheet ..
    In range(I2:K2) I have validation lists based on worksheet change (Mr. Berlan has achieved that part perfectly)
    Now I need to do the same idea exactly but in combo boxes in userform ..
    That's I have list of items in combobox1 and when selecting an item , the combobox2 items should be depending on combo1 selected ..
    the same with combobox3 depend on combobox2
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Unique items in combobox on userform

    Try this basic code for Userform:-
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique items in combobox on userform

    Thanks sir for your help
    When I loaded the form nothing populated in Combobox1 neither combobox2 ..
    I got it ...
    But Combobox1 should be first populated then combo2 then combo 3

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Unique items in combobox on userform

    So you want to select "Kind" then "Customer" then "No".
    Is that Correct ????

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique items in combobox on userform

    Yes that's right
    I tried to edit it by myself but i'm confused about the parameter in these lines
    Private Sub ComboBox1_Click()
        Call cValues(ComboBox1.Value, ComboBox2, 2)
    End Sub
    Private Sub ComboBox2_Click()
        Call cValues(ComboBox2.Value, ComboBox3, 1)
    End Sub
    I think it is related to the column number of data i need to populate..but when trying to edit i got errors

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Unique items in combobox on userform

    Try this:-
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    860

    Re: Unique items in combobox on userform

    Nice code MickG.

    Obj.List = Dic.keys
    Harry.

  8. #8
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique items in combobox on userform

    Thanks a lot for this great solution.
    It works like charm in your attachment .. When I copied the lines of code and use them in my attachment
    I got an error "Permession denied" run time error 70
    UserForm1.Show

  9. #9
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique items in combobox on userform

    Thanks a lot for this great solution.
    It works like charm in your attachment .. When I copied the lines of code and use them in my attachment
    I got an error "Permession denied" run time error 70
    UserForm1.Show

  10. #10
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Unique items in combobox on userform

    Have you removed the "Rowsource" value in combobox1, that was in your original sheet

  11. #11
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique items in combobox on userform

    Yes I removed RowSource in Combobox1 ..but still get the same error..
    It's weird ..I exported your Userform and import it to my file and it is working well ...
    I still need to know the cause of that weird problem

  12. #12
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Unique items in combobox on userform

    Not sure without seeing the file.
    When I first opened your file I was unable to fill the first combobox, for reasons unknown, so I just replaced them. Perhaps just another weird occurrence.

  13. #13
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique items in combobox on userform

    I restarted my pc and tested the file again and everything is perfect
    Thanks a lot for your great and perfect solution you provided me.
    Thank you very much

  14. #14
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Unique items in combobox on userform

    I restarted my pc and tested the file again and everything is perfect
    Thanks a lot for your great and perfect solution you provided me.
    Thank you very much

  15. #15
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Unique items in combobox on userform

    YasserKhalil, Great, Glad is all working for you.

    Harry ,Thank you !!!

+ 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] Unique Items in a combobox
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2015, 05:49 AM
  2. UserForm ComboBox ONLY display selected items in List
    By onmyway in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-16-2015, 01:02 PM
  3. [SOLVED] Userform - ListBox items added based on Combobox value selected
    By jayherring86 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-12-2014, 09:12 AM
  4. [SOLVED] Userform combobox display one of the items in list
    By Mr_Bill in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2014, 12:09 PM
  5. Populating Userform ComboBox Using Items from Content Control Combobox
    By anarxo in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2014, 01:00 PM
  6. Userform: Unique Values to ComboBox
    By dinosaur1993 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-21-2013, 03:09 AM
  7. [SOLVED] userform invalid property value only on certain items in combobox
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2013, 06:30 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