ListBox Selections to TextBox / ListBox / ComboBox

Hi Experts,

I am trying to get the following form to populate a TextBox in Excel (see attached file for screen shot).

Basically I've made the list box 'Single' as I want th user to only be able to select one option at a time.

I need to make it so they hit Add Country and it poulates the List (or Text / Combo box tp the right)

Once the list has been made I then need to give the user the option to delete an entry.

Once the list has been successfully compiled I will be taking it to a cell in the workbook.

If someone can advise of the best way to do this or a reference point on the net (I'm sure it's been done before) that would be amazing!

Thanks in advance for any help!
martywalAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy PooleCommented:
Hi, you did not post a screen shot, it would also be helpful if you attach the workbook.
0
martywalAuthor Commented:
Sorry, I was pretty sure it had uploaded...
Here is the screen shot
Will try and get a section of the workbook out shortly
Cheers
form.png
0
martywalAuthor Commented:
OK...

Hope this helps.
The attached is a section of the workbook with the form and the worksheet that the form depends on.

The idea is that when the user is selecting (click on) the "Serviced Countries" column (Cells F9:28) the form will open up.

They need to be able to select Multiple countries to be populated in the appropriate cell (as text "," delimited).

As you can see I've tossed around the idea of having a 'Multiple Locations'  option but this is not enough I'm afraid.

:-)
List-Selector.xlsm
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

martywalAuthor Commented:
Hi again Experts, just thought I'd see if the files I posted helped.
Pretty keen to try and get this worked out.
Sorry to be persistent.
Martywal
0
Randy PooleCommented:
Give this a try. I think it should do what your expecting. I also changed the listbox style to multi extended so you can select and move more then one choice at a time.
List-Selector.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
martywalAuthor Commented:
That's getting there Randy thanks heaps!
Just getting run-time error 424 on the 'continue' when I need to take the selection back to the cell that was double clicked (object required).
Will play about with it and see where I end up.
Cheers
0
Randy PooleCommented:
Replace the function "CONTINUEserveCMD_Click" in the workbook with this one:
Private Sub CONTINUEserveCMD_Click()
    Dim st As String, c As Integer
    st = ""
    For c = 0 To SelCountryLst.ListCount - 1
        If Len(st) > 0 Then st = st & ","
        st = st & SelCountryLst.List(c)
    Next
    Dim r As Range
    Set r = Module1.selRange
    r.Value = st
    Me.Hide
End Sub

Open in new window

0
martywalAuthor Commented:
Thanks Randy!
Yep that worked a treat!
One other very small issue I'm having is that sometimes when I hit 'Delete' it is taking not just the selected value but sometimes a couple and others ALL values.
Any thoughts there?
Thanks again
Martywal
0
martywalAuthor Commented:
It only seems to delete the full list if the bottom (most recently selected) country is highlighted when they select delete
0
martywalAuthor Commented:
Hi again,
Here's a screen shot that hopefully explains where I'm coming from.

In this case If I select Australia and hit 'Delete Country' it does the right thing...

If I hit Hong Kong (the bottom entry) it removes all countries.

The script currently looks like this:

Private Sub DELETEserveCMD_Click()
    Dim c As Integer
    MsgBox (c)
    For c = SelCountryLST.ListCount - 1 To 0 Step -1
        If SelCountryLST.Selected(c) Then
            ServCountryLst.AddItem SelCountryLST.List(c)
            SelCountryLST.RemoveItem (c)
        End If
    Next c
    SortLB ServCountryLst
End Sub

If best for me to open a new question just let me know.
0
Randy PooleCommented:
Can you post the workbook and tell me the steps to reproduce this. Thanks!
0
martywalAuthor Commented:
Hey Randy,
Just worked it out.
The list box (selcountrylst) needs to be set to extended 1...
Thanks for all your help!
Been great!
Cheers
Martywal
0
Randy PooleCommented:
NP :)
0
martywalAuthor Commented:
Prompt and accurate response.
A pleasure as always!
Thanks Randy!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.