ComboBox selected record’s all columns visible?

Sahak

Well-known Member
Joined
Nov 10, 2006
Messages
856
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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
10,195
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
856
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
10,195
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
856
Code:
Private Sub UserForm_Initialize()
    Combo_Employees.RowSource = "Employee_Records_Rng"
    '............
    '............
End Sub
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
10,195
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
10,195
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
856
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
10,195
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.
 

Forum statistics

Threads
1,089,505
Messages
5,408,685
Members
403,224
Latest member
rholmesa

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top