Add 2nd Column to ComboBox

J

Justin

Hi,
I am populating the ComboBoxes on my UserForm with the following code:


For v = 13 To 16

UserForm1.MultiPage1.Pages(0).MultiPage2.Pages(0).ComboBox1.AddItem
Format((Worksheets("Worksheet1").Cells(v, 9).Value), "#0.000")

Next v


I want to add a second column that is not visible to the user. The
trick is that I DO NOT want to format the 2nd column in the manner that
I am formatting the present column. And I want to make the new column
the bound column.

Any suggestions?

Your help is greatly appreciated!
 
N

NickHK

Justin,
You can set the columnwidth of the 2nd to 0 (or as small as possible).
You would need to set the columncount=2 and the boundcolumn to 2 also.

By the way, this would be a good situation to use a With block, to reduce
the number of objects (the number of "."s) that have to be resolved each
time.
With UserForm1.MultiPage1.Pages(0).MultiPage2.Pages(0).ComboBox1
For v = 13 To 16
.AddItem Format((Worksheets("Worksheet1").Cells(v, 9).Value),
"#0.000")
Next v
End With

NickHK
 
G

Guest

With UserForm1.MultiPage1.Pages(0).MultiPage2.Pages(0).ComboBox1
.Clear
.columncount = 2
.boundcolumn = 2
For v = 13 To 16


.AddItem Format((Worksheets("Worksheet1").Cells(v, 9).Value), "#0.000")
.list(.listcount-1,1) = Worksheets("Worksheet1").Cells(v, 9).Value
Next v
End with
 
G

Guest

forgot to hide the column

With UserForm1.MultiPage1.Pages(0).MultiPage2.Pages(0).ComboBox1
.Clear
.columncount = 2
.boundcolumn = 2
.ColumnWidths = "-1;0"
For v = 13 To 16


.AddItem Format((Worksheets("Worksheet1").Cells(v, 9).Value), "#0.000")
.list(.listcount-1,1) = Worksheets("Worksheet1").Cells(v, 9).Value
Next v
End with
 
J

Justin

Thanks that partially got the job done! I am going to post more
questions in a new topic that I can't figure out now. I really
appreciate the help guys!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top