Solved

Textbox with combobox selection choices

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

707 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

15 Experts available now in Live!

Get 1:1 Help Now