Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Textbox with combobox selection choices

Posted on 2013-05-29
3
Medium Priority
?
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 35

Accepted Solution

by:
Norie earned 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

597 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