Solved

Textbox with combobox selection choices

Posted on 2013-05-29
3
222 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Insert Column Macro 3 38
change VBA to show result in cells rather than debug.print 4 34
Fixing a embedded format 7 29
Excel Save As Status Box will not go away 6 16
Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

914 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now