+ Reply to Thread
Results 1 to 11 of 11

UserForm;comboBox,ListBox

  1. #1
    Registered User
    Join Date
    02-28-2009
    Location
    Jakarta
    MS-Off Ver
    Excel 2007
    Posts
    12

    UserForm;comboBox,ListBox

    how to created userform with combobox and listbox
    combobox have 3 option to select (Number,Colour and Name)
    and the listbox will show about 3 different of data

    Number data :1001,1002,1003,1004,1005
    Colour data :Black,Blue,Red,Yellow,Green
    Name data : Jhonson,Robert,Tina,Sabrina,Leonardo

    so when i choose Number on combobox ,the Listbox will show me data 1001,1002,1003,1004,1005
    but when i choose Colour ,listbox will show me Black,Blue,Red,Yellow,Green
    and then Name will show Jhonson,Robert,Tina,Sabrina,Leonardo

    ok i put data on
    sheet1 like this
    Coloumn A1 :Number B1 : Colour C1 : Name
    A2 :1001 B2 : Black C2 : Jhonson
    A3 :1002 B3 : Blue C3 : Robert
    A4 :1003 B4 : Red C4 : Tina
    A5 :1004 B5 : Yellow C5 : Sabrina
    A6 :1004 B6 : Green C6: Leonardo

    And i post my sample worksheet
    Thanks for your help.
    Attached Files Attached Files
    Last edited by VBA Noob; 03-01-2009 at 11:43 AM.

  2. #2
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: UserForm;comboBox,ListBox

    hey samara

    i don't how to fill all range you want in a listbox but try to modify this code maybe you'll get a solution.

    Please Login or Register  to view this content.
    when selection "Number" from ComboBox it prints "1001" on the ListBox.
    note: you should write "Number" in the ComboBox, see the attached file!
    regards
    Attached Files Attached Files
    Last edited by mehdoush; 02-28-2009 at 11:36 AM.

  3. #3
    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,ListBox

    You need to remove the rowsource property of the combobox, then use this code
    Please Login or Register  to view this content.
    Edit: forgot to mention that each column is a Dynamic Named Range - Number, Colour, Name, corresponding with the combo's values.
    Attached Files Attached Files
    Last edited by royUK; 02-28-2009 at 11:41 AM.
    Hope that helps.

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

    Free DataBaseForm example

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: UserForm;comboBox,ListBox

    Here's one way,

    Use this code in the userforms code module
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    02-20-2009
    Location
    La, CA
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: UserForm;comboBox,ListBox

    that's great both of you
    Last edited by mehdoush; 02-28-2009 at 11:54 AM.

  6. #6
    Registered User
    Join Date
    02-28-2009
    Location
    Jakarta
    MS-Off Ver
    Excel 2007
    Posts
    12

    Thumbs up Re: UserForm;comboBox,ListBox

    wow that's work perfect
    thank all


  7. #7
    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,ListBox

    If you are satisfied with the solution(s) provided, please mark your thread as Solved and rate the answer(s).

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  8. #8
    Registered User
    Join Date
    02-28-2009
    Location
    Jakarta
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: UserForm;comboBox,ListBox

    Ok Roy , that's cool

    I want ask you how about if i use 3 option button to make a change
    i post new book and userform
    i make it 2 frame
    frame 1 it is ok

    frame 2 have 3 option button and 1 combobox
    option1 is number
    option2 is colour
    option3 is name

    when we choose
    option1 combobox2 will show data number : 1001,1002,1003,1004,1005
    option2 combobox2 will show data colour : Black,Blue,Red,Yellow,Green
    option3 combobox2 will show data name :Jhonson,Robert,Tina,Sabrina,
    Leonardo

    can you?
    mmm....anyway thank for you help Roy
    Attached Files Attached Files
    Last edited by samsara; 03-01-2009 at 05:13 AM.

  9. #9
    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,ListBox

    It's not difficult to dapt the code
    Please Login or Register  to view this content.
    Do the same for the other two optionbuttons, , just change he optionbutton refered to.

  10. #10
    Registered User
    Join Date
    02-28-2009
    Location
    Jakarta
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: UserForm;comboBox,ListBox

    This is exactly what i was looking for. Thank so much for your help....

  11. #11
    Registered User
    Join Date
    02-28-2009
    Location
    Jakarta
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: UserForm;comboBox,ListBox

    Roy...please once again to help me

    I try to use 2 combobox to filter a data
    combobox1 have data:name,colour,number
    combobox2 have data filter from combobox1
    i try to change the code and make it right but still have problem
    dont know how...
    please...see my sample
    and thank's for your time...
    Attached Files Attached Files
    Last edited by samsara; 03-03-2009 at 09:07 AM. Reason: i need to know how its work

+ 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