Thread: Array question
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Array question

VBA doesn't support control arrays.

for i = 1 to 5
userform1.Controls("Combobox" & i).List = Array(1,2,3,4,5)
Next

--
Regards,
Tom Ogilvy

"Lee" wrote in message
...
In VB, when you copy a control or give two controls the
same name, VB asks if you want to create an array, and
creates the name with a subscript, such as Textbox(1),
Textbox(2), etc. It appears that VBA does not do this.
I'm not sure how to declare an array here.

I have five dropdown combo boxes that I want to each fill
with the same five values, and it seemed most efficient to
do this with an array.