Solved

Textbox with combobox selection choices

Posted on 2013-05-29
3
233 Views
Last Modified: 2013-06-13
Excel 2010 vba

Userform
Multipage Tab Specifically "page 9"

Textbox1
8 comboboxes

Combobox1 to Combobox8
Scenario:

Comboxes are filled with items.

Not All comboboxes are filled
Combobox1 to combobox 5 may only contain items at times..

 
What I need:

As i make selections in the comboboxes.
I need the Textbox to be updated with the choices from the comboboxes.
With a seperation character semicolon    ;

Combobox1 selected = drill
Combobox3 selected = 1/2 inch
combobox6 selected = brown

The the result in the Textbox could be:
drill;1/2 inch;brown


Thanks
fordraiders
0
Comment
Question by:fordraiders
3 Comments
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 39205025
Add this in the userform module and call it from each of the comboboxes change event.

Sub FillTextBox()
Dim I As Long
Dim arrCBVals()
Dim idx As Long

    For I = 1 To 8

        If MultiPage1.Pages(8).Controls("ComboBox" & I).ListIndex <> -1 Then
            If MultiPage1.Pages(8).Controls("ComboBox" & I).Value <> "" Then
                ReDim Preserve arrCBVals(idx)

                arrCBVals(idx) = MultiPage1.Pages(8).Controls("ComboBox" & I).Value
                idx = idx + 1
            End If
        End If
    Next I

    MultiPage1.Pages(8).Controls("TextBox1").Value = Join(arrCBVals, ";")

End Sub

Open in new window



Private Sub ComboBox1_Change()
    FillTextBox
End Sub

Private Sub ComboBox2_Change()
    FillTextBox
End Sub

'etc...

Open in new window

0
 
LVL 24

Expert Comment

by:Steve
ID: 39205039
If you have the comboboxes done, to fill the textbox you would just use the Join function in the afterUpdate for all the comboboxes...

dim arr(4)
arr(0) = combobox1.value
arr(1) = combobox2.value
arr(2) = combobox3.value
arr(3) = combobox4.value
arr(4) = combobox5.value

Textbox.value = Join(arr, ";")

Open in new window

0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 39245182
Thanks
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question