Dynamically Assign Objects to Form Objects.

  • Thread starter Thread starter The Vision Thing
  • Start date Start date
T

The Vision Thing

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.
 
For i = 1 To 10
Set objDdl = Userform1.Controls("ddlwb" & i)
'do something else with objDdl
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top