none
2 combobox - one populate another RRS feed

  • General discussion

  • Hi,

    I have a 2 combo boxes on user form in excel linked to F and G column respectively. I want combo box for F to enter suffix Mr., Mrs., Miss, Dr. etc. before name by some selection and when typing name done, populate combo box for G automatically.

    Secondly If I do not type name in combo box for F and only open drop down list to populate (which is in numbers) make combo box for G not to populate any thing.

    Is it possible ? please help.

    dockhem

    Monday, August 18, 2014 6:46 PM

All replies

  • Hi,

    According to your description, I don't understand your requirement clearly.

    How do your 2 combo boxes link to F and G column?

    >>before name by some selection and when typing name done<<

    I assume combobox1 is combo box for F and the combobox2 is combo box for G. Do you mean the combobox1 lists the names and you could type or select a name in the combobox1, then if you type or select a name in cobobox1, it need to add "Mr., Mrs., Miss or Dr." before the name and populate a new string to display in combobox2?

    If so, I write a sample for your reference. In my sample, I use the AfterUpdate event of Combobox1 object to capture the name you type in and use the Change event to capture the selection changing of Combobox1. It will add "Mr " before the name when populating new item in Combobox2.

    Private Sub ComboBox1_AfterUpdate()
        PopulateCombobox2
    End Sub
    
    Private Sub ComboBox1_Change()
        PopulateCombobox2
    End Sub
    
    Sub PopulateCombobox2()
    ComboBox2.Clear
    If ComboBox1.Value <> "" Then
        ComboBox2.AddItem "Mr " + ComboBox1.Value
    End If
    ComboBox2.ListIndex = 0
    End Sub
    
    'Private Sub UserForm_Initialize()
    'ComboBox1.List = Range("F1:F5").Value
    'End Sub
    


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, August 19, 2014 10:11 AM
    Moderator
  • Hi Dockhem

    It's clear as mud. Are you still on the same Userform ?

    First Combobox with the listing : Mr. Miss. Dr. etc. Yes or No

    Second Combobox . What is the listing ? 

    You can list numbers plus you can type in the combobox . You can have that choice.


    Cimjet

    Tuesday, August 19, 2014 1:07 PM
  • Please see this link for some ideas.

    http://www.contextures.com/xlDataVal13.html


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Wednesday, August 20, 2014 1:46 PM
  • Hi Cimjet,

    Yes, it is same work. I want to make it perfect. I meant Dr or Mr or Mrs etc then name and then last name or surname. I want to select first part, then type the name and then select last from combo box populate.

    Mr. ABC XYZ

    Dr. WER HJK

    likewise

    thank you

    dockhem

    Wednesday, August 20, 2014 4:42 PM
  • Hi

    See link: http://dropcanvas.com/9u6wp

    The sample form that I have, is not made to add suffix and name in those columns.

    I made a new sample file with just what you asked and maybe you can had it to your form.

    If not, post back with a link of your new form and I will set it up for you.


    Cimjet


    • Edited by Cimjet Wednesday, August 20, 2014 9:40 PM
    Wednesday, August 20, 2014 8:00 PM
  • Hi

    See link: http://dropcanvas.com/9u6wp

    The sample form that I have, is not made to add suffix and name in those columns.

    I made a new sample file with just what you asked and maybe you can had it to your form.

    If not, post back with a link of your new form and I will set it up for you.


    Cimjet


    Thank you Cimjet,

    I do not how to put this thing in a better way on excel. I want things like Mr., Mrs. and Dr. should come just by selection in combo box or list box or selection box or other control on user form. Then I type name next to it. Again with automatic  space I type surname. It will give better speed. I want every thing in easy way. Because we who will use it, are not fast on computer typing.

    regards

    dockhem

    Friday, August 22, 2014 12:35 AM
  • Hi

    Reading your post tell's me that 2 combobox would work for you. You can select from one combobox the suffix and you can add first name if you like, just by typing in the cbox. Then you can select the last name in the second cbox, or leave it empty. Combobox are very flexible. I can't tell you what is the best way for you. That is a choice you have to make.

    I believe you know how to set up the combobox so I don't know what you want exactly.


    Cimjet

    Friday, August 22, 2014 12:58 PM
  • Hi Cimjet,

    I do not know how to select Mr, Mrs etc. and then type name in combo box, both things together. I can only select from drop down population.

    dockhem

    Sunday, August 24, 2014 8:05 AM
  • HI

    See sample file: http://dropcanvas.com/0siom

    With one combobox, you select the suffix then click in the combobox and type the name.


    Cimjet

    Sunday, August 24, 2014 12:40 PM
  • Thank you Cimjet,

    I wanted such thing. Can it have Mr selected by default, I can select another if needed. Is it possible ?

    dockhem

    Sunday, August 24, 2014 12:57 PM
  • Hi

    See link: http://dropcanvas.com/1q58r

    This one with "Mr. " already in the Combobox.

    How. ?

    See in the Properties window for the combobox under "Value".


    Cimjet

    Sunday, August 24, 2014 5:43 PM
  • Thank you Cimjet.

    regards

    dockhem

    Sunday, August 24, 2014 6:20 PM
  • Hi

    If this post is answered, would you mark it as Answered.

    Thank you


    Cimjet

    Sunday, August 24, 2014 8:54 PM
  • Sorry, I do not see "Mark as answer" on my side in this thread. I do not know why ?

    dockhem

     
    Monday, August 25, 2014 1:05 AM
  • It's okay

    The post was started as a discussion, not a question.

    I just notice it now after your reply.

    Thanks for the feedback anyway.


    Cimjet

    Monday, August 25, 2014 1:16 AM