ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding a column in a multicolumn combobox (https://www.excelbanter.com/excel-programming/328607-hiding-column-multicolumn-combobox.html)

Mike Jones

Hiding a column in a multicolumn combobox
 
A number of articles/posts have hinted that you can have a multicolumn
combobox, and then set the columns that you don't want to see to size of
zero. But I'm not seeing that this works--the column I want to hide
still appears.

Is this possible? Advice?

Thanks.

Bob Phillips[_6_]

Hiding a column in a multicolumn combobox
 
Mike,

All you need to do is load multiple columns in the combobox, but don't set
the columncount property, leave it at the default 1. Then just access the
subsequent column as any other multi-column combobox, for example

Private Sub ComboBox1_Click()
MsgBox ComboBox1.List(ComboBox1.ListIndex, 1)
End Sub

Private Sub UserForm_Activate()
Dim ary, i, j

ary = [{"Bob","M", 123;"Lynne","F",898;"Amy","F",543}]

With ComboBox1
.ColumnCount = 1 'not necessary, juts to prove it
For i = 1 To 3
.AddItem ary(i, 1)
For j = 2 To 3
.List(.ListCount - 1, j - 1) = ary(i, j)
Next j
Next i
End With
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike Jones" wrote in message
...
A number of articles/posts have hinted that you can have a multicolumn
combobox, and then set the columns that you don't want to see to size of
zero. But I'm not seeing that this works--the column I want to hide
still appears.

Is this possible? Advice?

Thanks.





All times are GMT +1. The time now is 11:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com