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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

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