ComboBox selected record’s all columns visible?

Sahak

Well-known Member
Joined
Nov 10, 2006
Messages
864
Hi all,

After DropButton Clicking, it shows all CoboBox’s records with columns visible, but after selecting a record from list, CoboBox shows first column’s value only, rest columns are hidden. Is there a way to show selected record’s all columns?

Thank you in advance
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
11,075
Office Version
2007
Platform
Windows
You can give more detail than you have.
Is the combobox on the sheet? It is a combobox of userform or ActiveX control.
Or is it a combobox in a userform?
You have a code to load the data into the combobox, you can put that code here.
 

Sahak

Well-known Member
Joined
Nov 10, 2006
Messages
864
Thank you Dante for reply, the combo on Userform & its RowSource comes from worksheet records range, let say four columns & ten rows
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
11,075
Office Version
2007
Platform
Windows
You have a code to load the data into the combobox, you can put that code here.
 

Sahak

Well-known Member
Joined
Nov 10, 2006
Messages
864
Code:
Private Sub UserForm_Initialize()
    Combo_Employees.RowSource = "Employee_Records_Rng"
    '............
    '............
End Sub
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
11,075
Office Version
2007
Platform
Windows
ok, I already understood what the problem is.Give me a moment to review it.
 
Last edited:

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
11,075
Office Version
2007
Platform
Windows
CoboBox shows first column’s value only, rest columns are hidden.
That happens, because in the combo value you can only have one column.

Is there a way to show selected record’s all columns?
To add the 4 columns, I am concatenating the 4 columns into a single value.


Try this:

Code:
Dim [COLOR=#0000ff]loading [/COLOR]As Boolean  [COLOR=#008000]'To the top of all the code[/COLOR]


Private Sub Combo_Employees_Change()
  With Combo_Employees
    If .Value = "" Then Exit Sub
    If .ListIndex = -1 Then Exit Sub
    If [COLOR=#0000ff]loading [/COLOR]= True Then Exit Sub
    [COLOR=#0000ff]loading[/COLOR] = True
    .Value = .List(.ListIndex, 0) & " " & .List(.ListIndex, 1) & " " & _
             .List(.ListIndex, 2) & " " & .List(.ListIndex, 3)
  End With
  [COLOR=#0000ff]loading [/COLOR]= False
End Sub


Private Sub UserForm_Initialize()
  [COLOR=#0000ff]loading [/COLOR]= True
  Combo_Employees.RowSource = "Employee_Records_Rng"
  [COLOR=#0000ff]loading [/COLOR]= False
  '...
  '...
End Sub
 

Sahak

Well-known Member
Joined
Nov 10, 2006
Messages
864
Yes, concatenating will work, but not separate, i see, it cant be done. Thank you very much for trying to help me, have a nice day.
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
11,075
Office Version
2007
Platform
Windows
You can leave the data of the first column in the combobox and concatenate the 4 columns in a label, for example.
 

Watch MrExcel Video

Forum statistics

Threads
1,095,324
Messages
5,443,809
Members
405,251
Latest member
shanezer

This Week's Hot Topics

Top