Populate UserForm ComboBox with Multiple columns and textbox with selection

03856me

Active Member
Joined
Apr 4, 2008
Messages
297
I have the following code that works as it is but I have been asked to include 5 columns of data in the comboBox helping the user with their selection. Right now the ComboBox is populating with the p o number only. I know how to do this with a ListBox but not a combobox. Once the user selects an item I would like TextBox1 updated with the p o number only, then the remainder of my code would work properly. Can someone help me with modifying the code for multi columns.

Code:
Private Sub UserForm_Initialize()    
     Dim xpo As Range
    Dim ws As Worksheet
    Set ws = Worksheets("matrixWLC")
    For Each xpo In ws.Range("WLCmatrixTable[po]")
        With Me.cbo_po
            .AddItem xpo.Value
        End With
    Next xpo
End Sub
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
How about
Code:
Private Sub ComboBox1_Click()
   Me.TextBox1.Value = Me.cbo_po.Value
End Sub

Private Sub UserForm_Initialize()
   With Me.cbo_po
      .ColumnCount = 5
      .List = Sheets("matrixWLC").Range("WLCmatrixTable[po]").Resize(, 5).Value
   End With
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top