PDA

View Full Version : multiple columns in a list box



vesuve
06-13-2018, 07:19 AM
New at VBA.
On my user form, I have a list box with date from 3 columns (name, First name and number); the value returned is nothing. How could I assign the information from the 3 columns to a variable?

I also have a command button on my user form that should allow to save the information but it doesn't work.

Jan Karel Pieterse
06-13-2018, 08:47 AM
The returned info (Value) of a listbox or combobox is determined by the BoundColumn property. The remaining information can be read as follows:

With ListBox1
If .ListIndex>-1 Then
MsgBox "Value of col 1: " & .List(.listIndex,0)
MsgBox "Value of col 2: " & .List(.listIndex,1)
MsgBox "Value of col 3: " & .List(.listIndex,2)
End If
End With

vesuve
06-13-2018, 11:16 AM
New at VBA.
On my user form, I have a list box with date from 3 columns (name, First name and number); the value returned is nothing. How could I assign the information from the 3 columns to a variable?

I also have a command button on my user form that should allow to save the information but it doesn't work.



Thanks for the info, I will try it!!!