ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combobox list items (https://www.excelbanter.com/excel-programming/378278-combobox-list-items.html)

joeeng

Combobox list items
 
Can a Combobox list contain only one item? For instance,

Combobox.List = "List Item 1"
or
Combobox.List = Range(Cells(1,1),cells(1+Ivalue,1)).Value
where Ivalue=0 sometimes

I keep getting an error "List property cannot be set"

Bob Phillips

Combobox list items
 
Combobox1.Value = "List Item 1"

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"joeeng" wrote in message
...
Can a Combobox list contain only one item? For instance,

Combobox.List = "List Item 1"
or
Combobox.List = Range(Cells(1,1),cells(1+Ivalue,1)).Value
where Ivalue=0 sometimes

I keep getting an error "List property cannot be set"




joeeng

Combobox list items
 
I actually want the list to have only one item at times and many items at
other times.

"Bob Phillips" wrote:

Combobox1.Value = "List Item 1"

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"joeeng" wrote in message
...
Can a Combobox list contain only one item? For instance,

Combobox.List = "List Item 1"
or
Combobox.List = Range(Cells(1,1),cells(1+Ivalue,1)).Value
where Ivalue=0 sometimes

I keep getting an error "List property cannot be set"





Charles Chickering

Combobox list items
 
Joe, try either looping through your range and using the .AddItem method or
set the .RowSource of the combobox to your range. For example:
Dim rCell as Range
Dim r as Range
Set r = Range("A1:A10")
For Each r in rCell.Cells
ComboBox1.AddItem r
Next

or more simply:
Dim r as Range
Set r = Range("A1:A10")
ComboBox1.RowSource = r.Address

--
Charles Chickering

"A good example is twice the value of good advice."


"joeeng" wrote:

I actually want the list to have only one item at times and many items at
other times.

"Bob Phillips" wrote:

Combobox1.Value = "List Item 1"

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"joeeng" wrote in message
...
Can a Combobox list contain only one item? For instance,

Combobox.List = "List Item 1"
or
Combobox.List = Range(Cells(1,1),cells(1+Ivalue,1)).Value
where Ivalue=0 sometimes

I keep getting an error "List property cannot be set"






All times are GMT +1. The time now is 03:52 AM.

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