I have a user form (excel, VBA) where there is a 2 column combobox. When user selects a certain value from the combobox, I want to get the value he selected, and the value associated with the first value (ie. the second column value).
How do I do this? Simply ComboBox1.Value
returns the value of the first column. ComboBox1.Value(0)
doesn't work.
Set the ColumnWidth to "0;100" and you will see the second column. Make sure that there is a working relationship between the width of the box and that of the columns to be displayed within it. Show activity on this post. Use a text field ond the right side of the combo box.
Multi-Column ComboBox from Worksheet Data (Easy Method) Go to the VBA window (Alt + F11) > Double-click the UserForm from the Project Explorer (Ctrl + R) > Click on the ComboBox and look to the Properties Window (F4). Change the ColumnCount property to the number of columns that you have.
Combo Box Settings To show two columns in the combo box, open its property window, and change its ColumnCount setting to 2. When you double-click on a data validation cell, event code runs, that finds the list used in the data validation cell. Then, “Full” is added to that name, to find the list for the combo box.
This documentation is valid for: It is a type of control similar to a combo box, and the difference is that the set of possible values are read from a database table.
Use the column property of the combobox. It is 0-based so the first column is column(0) and the second column is column(1).
Me.ComboBox1.Column(1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With