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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
11,044
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,044
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,044
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,044
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,044
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,185
Messages
5,442,876
Members
405,206
Latest member
warviksam

This Week's Hot Topics

  • Copy entire row if CountA <>0 to another sheet
    [B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
  • Select last used Row in Table
    I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
  • excel workbook: do not allow certain file name
    Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
  • fixing problem autofilter
    hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
  • “Weight”
    Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
  • How to capitalize everything before a certain character?
    In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...
Top