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
Solved

Textbox with combobox selection choices

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
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;…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

789 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