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 Dynamically Assign Objects to Form Objects.

For i = 1 To 10
Set objDdl = Userform1.Controls("ddlwb" & i)
'do something else with objDdl
Next

--
Regards,
Tom Ogilvy

"The Vision Thing" wrote in message
...
I have ten listboxes on a form, ddlwb1, ddlwb2 etc. I want to loop

through
them and dynamically assign them to an object like so:

For i = 1 To 10
Set objDdl = ddlwb & i
'do something else with objDdl
Next

Obviously this doesn't work, but I vaguely recall a command that will make
it work, though for the life of me I can't remember what.

Thanks,
Wayne C.