Adding a Value List to Combo Box

K

kirkm

I thought this would be easy!

My instructions are

Set the Row source Type property to Value List

0n the Data tab of the property sheet,
click .... to open the Edit List Items
dialog box, and then type the items on
separate lnes.

However I have no such Selection available in RowSource.

Another instruction says


The combo and list box controls allow you to enter a list of items.
When you choose this route, you enter in the control's Row Source
property a setting in the form of

"item1";"item2";"item3"

But if I enter that into RowSource, Excel tells me

Could not set the RowSource property. Invalid property value.

Very frustrating! Anyone know why this isn't working?

Thanks - Kirk
 
T

Tom Ogilvy

where are you getting these instructions. Are they for Excel. I don't use
Access, but it seems It is possible in Access (although I believe the
correct way is a combination of the two ways you describe) - anyway to the
best of my knowledge it isn't possible in Excel for a listbox/combobox from
the control toolbox toolbar.

In excel, you can use additem to add items to a listbox or combobox at
runtime or assign the rowsource/listfillrange property to a range either
using the properties window or at runtime.

In excel, you can type in a comma separated list when using the the list
option under Data =>Validation (method #2). This is a form of combobox.
 
K

kirkm

where are you getting these instructions.

Mainly from hours of Googling around and being sent up many garden
paths :)
Are they for Excel.

So it says. I don't know, and I can't make it work.
I don't use
Access, but it seems It is possible in Access (although I believe the
correct way is a combination of the two ways you describe) - anyway to the
best of my knowledge it isn't possible in Excel for a listbox/combobox from
the control toolbox toolbar.

I've lost you there. Caqn I rephrase the question ?

Can you have a list or combo box displaying e.g. three choices,
Info1, Info2, Info3. The words 'Info1" etc aren't in a cell on a
sheet but are hard wired (constants ?)
In excel, you can use additem to add items to a listbox or combobox at
runtime or assign the rowsource/listfillrange property to a range either
using the properties window or at runtime.

I'll search more for AddItem. May fluke a decent example.
In excel, you can type in a comma separated list when using the the list
option under Data =>Validation (method #2). This is a form of combobox.

I don't follow, sorry. I've only these choices under Data

Data
BoundColumn
ColumnCount
ColumnHeads
ColumnWidths
ControlSource
ListStyle
RowSource
Text
TextColumn
TopIndex


Thanks - Kirk
 
T

Tom Ogilvy

No, you can't use this approach in Excel - is that clearer.

This is what you can do:

Private Sub Userform_Initialize()
Listbox1.Rowsource = ""
Me.Listbox1.AddItem "Info1"
Me.Listbox1.AddItem "Info2"
Me.Listbox1.AddItem "Info3"
End sub
In excel, you can type in a comma separated list when using the the list
option under Data =>Validation (method #2). This is a form of combobox.
This suggestion was a possible alternative to whatever you are trying to
achieve which does not use the type of combobox you are trying to use.
disregard it an place all your energy in using AddItem.
 
K

kirkm

No, you can't use this approach in Excel - is that clearer.

Yes, yes!! Something I stumbled over said I could.... and I
foolishly believed it!
This is what you can do:

Private Sub Userform_Initialize()
Listbox1.Rowsource = ""
Me.Listbox1.AddItem "Info1"
Me.Listbox1.AddItem "Info2"
Me.Listbox1.AddItem "Info3"
End sub

This suggestion was a possible alternative to whatever you are trying to
achieve which does not use the type of combobox you are trying to use.
disregard it an place all your energy in using AddItem.


Many thanks Tom, it all makes sense now. I succeeded with the AddItem
method, but then discovered a Hidden Form was possible and this
provided a storage means as well.

Cheers - Kirk
 

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