Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
is it possible to add all the items in a range
named "Users" to a combo box with one line of code instead of having to do a with combobox .clear .additem .additem .additem .additem .additem .additem end with for like 20 to maybe over 50 items. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
actually i did it in the properties for the combobox
i named the range and set the ListRows property to "RANGE NAME" and made the name refer to "=offset(Range,0,0 COUNTA (A:A),1) so i can add to it. but thatnx for the code, i will keep it for reference. -----Original Message----- You can use a FOR-NEXT loop. See the example below. Sub add_to_combobox() Dim tmp As Integer Dim my_range Set my_range = Range("A1:A50") 'you can change this With combobox .Clear For tmp = 1 To my_range.Cells.Count .AddItem my_range.Cells(tmp).Value Next End With End Sub ----- spence wrote: ----- is it possible to add all the items in a range named "Users" to a combo box with one line of code instead of having to do a with combobox .clear .additem .additem .additem .additem .additem .additem end with for like 20 to maybe over 50 items. . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ComboBox1.List = Range("Users").Value
"spence" wrote in message ... is it possible to add all the items in a range named "Users" to a combo box with one line of code instead of having to do a with combobox .clear .additem .additem .additem .additem .additem .additem end with for like 20 to maybe over 50 items. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Access items stored in combobox | Excel Discussion (Misc queries) | |||
ComboBox Items | Excel Programming | |||
ComboBox Default items Not Showing | Excel Programming | |||
missing items in sheet's activex list/combobox after resizing range | Excel Programming | |||
ComboBox items | Excel Programming |