Add a range to a combobox with multiple columns

IraAI

New Member
Joined
Feb 9, 2025
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello, Im trying to add a range to a combobox with multiple columns. But for the life of me, i can't seem to get the second column to display.

1739155296739.png


I've tried to via the follwing code too but no luck:
For i = 1 To rngLstVC.Rows.Count
.AddItem rngLstVC(i, 1)
.List(.ListCount - 1, 1) = rngLstVC(i, 2)
Next

I've also tried creating a name range "VCTable".. (they all work but all only display the first column).
With frmSupplierMgt.cbSupplierType1
.ColumnCount =2
.List = ThisWorkbook.Sheets("Codes").Range("VCTable").Value
.BoundColumn = 1
.ColumnWidths = "20;100"
End With

This is the result i keep getting.. I need both values in the drop down but then the columnbound =1 to display in the combo box on selection.

1739155415670.png


1739155828754.png


Appreciate any help. :)
 
Hello, Im trying to add a range to a combobox with multiple columns. But for the life of me, i can't seem to get the second column to display.

View attachment 122205

I've tried to via the follwing code too but no luck:
For i = 1 To rngLstVC.Rows.Count
.AddItem rngLstVC(i, 1)
.List(.ListCount - 1, 1) = rngLstVC(i, 2)
Next

I've also tried creating a name range "VCTable".. (they all work but all only display the first column).
With frmSupplierMgt.cbSupplierType1
.ColumnCount =2
.List = ThisWorkbook.Sheets("Codes").Range("VCTable").Value
.BoundColumn = 1
.ColumnWidths = "20;100"
End With

This is the result i keep getting.. I need both values in the drop down but then the columnbound =1 to display in the combo box on selection.

View attachment 122206

View attachment 122208

Appreciate any help. :)
Wecome to Mr Excel

Do any of these methods work for you?

VBA Code:
Private Sub UserForm_Initialize()
Dim i As Integer
  
  With Me.ComboBox1
  
    .ColumnCount = 3
    
    .ColumnWidths = "40,40,40"
    
    .BoundColumn = 1
  
    For i = 1 To 10
    
      .AddItem
      .List(.ListCount - 1, 0) = "One"
      .List(.ListCount - 1, 1) = "Two"
      .List(.ListCount - 1, 2) = "Three"

    Next i

  End With
  
  With Me.ComboBox2
    
    .ColumnCount = 3
    
    .ColumnWidths = "40,40,40"
    
    .BoundColumn = 1
    
    .RowSource = Worksheets("Sheet1").Range("A1:C10").Address
  
  End With
  
  With Me.ComboBox3
    
    .ColumnCount = 3
    
    .ColumnWidths = "40,40,40"
    
    .BoundColumn = 1
    
    .RowSource = Range("combolistdata").Address
    
  End With
  
  With Me.ComboBox4
    
    .ColumnCount = 3
    
    .ColumnWidths = "40,40,40"
    
    .BoundColumn = 1
    
    .RowSource = Worksheets("Sheet1").Range("A1:C" & Cells(Rows.Count, "A").End(xlUp).Row).Address
    
  End With
  

End Sub
 
Upvote 0
With Me.ComboBox1 .ColumnCount = 3 .ColumnWidths = "40,40,40" .BoundColumn = 1 For i = 1 To 10 .AddItem .List(.ListCount - 1, 0) = "One" .List(.ListCount - 1, 1) = "Two" .List(.ListCount - 1, 2) = "Three" Next i End With With Me.ComboBox2 .ColumnCount = 3 .ColumnWidths = "40,40,40" .BoundColumn = 1 .RowSource = Worksheets("Sheet1").Range("A1:C10").Address End With With Me.ComboBox3 .ColumnCount = 3 .ColumnWidths = "40,40,40" .BoundColumn = 1 .RowSource = Range("combolistdata").Address End With With Me.ComboBox4 .ColumnCount = 3 .ColumnWidths = "40,40,40" .BoundColumn = 1 .RowSource = Worksheets("Sheet1").Range("A1:C" & Cells(Rows.Count, "A").End(xlUp).Row).Address End With
I tried all of them.. and they all failed.. and then i got to the last option.. i changed it to the 2 columns that i needed.. and IT WORKED!
Legend thankyou. I can sleep tonight.
1739172391652.png

With Me.cbSupplierType1

.ColumnCount = 2

.ColumnWidths = "40,100"

.BoundColumn = 1

.RowSource = Worksheets("Codes").Range("A3:B" & Cells(Rows.Count, "A").End(xlUp).Row).Address

End With
 
Upvote 0
Solution
I tried all of them.. and they all failed.. and then i got to the last option.. i changed it to the 2 columns that i needed.. and IT WORKED!
Legend thankyou. I can sleep tonight.
View attachment 122211
With Me.cbSupplierType1

.ColumnCount = 2

.ColumnWidths = "40,100"

.BoundColumn = 1

.RowSource = Worksheets("Codes").Range("A3:B" & Cells(Rows.Count, "A").End(xlUp).Row).Address

End With
I posted various option just to show you what is possible.

Do you want to display the Supplier Type text in the box to the right of each combobox?

Don't ever lose sleep over an Excel problem when you have Mr Excel.
 
Upvote 0
I posted various option just to show you what is possible.

Do you want to display the Supplier Type text in the box to the right of each combobox?

Don't ever lose sleep over an Excel problem when you have Mr Excel.
Yes, that's all working now too.. thankyou so much. :)
1739183461165.png
 
Upvote 0

Forum statistics

Threads
1,226,771
Messages
6,192,919
Members
453,767
Latest member
922aloose

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