ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add values to a dropdown box (https://www.excelbanter.com/excel-programming/331715-add-values-dropdown-box.html)

Man Utd

Add values to a dropdown box
 
How do I add values to a dropdown box?
Like
John
Peter
Mary
.....



Snake Plissken[_2_]

Add values to a dropdown box
 
try this way:


Sub qq()
Dim table_range

table_range = Array(ComboBox1, ComboBox2, ComboBox3..... ComboBox100) ' one
or set of many combos in a form

For i = 0 To 57 'e.g values or variables concerning number of combos -
optional line
table_range(i).AddItem "Z1" ' values or variables
table_range(i).AddItem "Z2"
table_range(i).AddItem "Z3"

Next i

'or

Dim combo As ComboBox
table_range = Array(ComboBox1, ComboBox2, ComboBox3..... ComboBox100)


For i = 0 To 57

Set combo = table_range(i)
combo.AddItem "Z1"
combo.AddItem "Z2"
combo.AddItem "Z3"

Next i

End Sub



How do I add values to a dropdown box?
Like
John
Peter
Mary
....



Patrick Molloy[_2_]

Add values to a dropdown box
 
additionally, of th esource of the list is a named range, then just extend
the range to cover new items ... using a dynamic range will save some trouble.

"Man Utd" wrote:

How do I add values to a dropdown box?
Like
John
Peter
Mary
.....





All times are GMT +1. The time now is 12:25 PM.

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