Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box fill 1

Status
Not open for further replies.

stibbetts

Technical User
May 6, 2004
64
US
i have a user form with one tab, on this tab there are 6 combo boxes, is there any 'For Each' statement or something else (to bad there isn't a 'For All') that i can use to edit all of them and enter the same info into each list? the reason i ask is because although there is only one tab to start, there can be an unlimited amount created and i want to be able to enter this info into all of the boxes without having to create a constant in code eg. combobox1, combobox2...ect. that would not be a viable option.
 
Why not just write a little function that accepts a combo box as an argument that clears the combobox (optional), then loads the list of values into it.

That way you could call the function from within a loop (to do all of the boxes), or just call it for one of them.

VBAjedi [swords]
 
hense my problem, i cant seem to get it to call for combo boxes in a loop, or a for statementi have to manually enter the name, but ill never know exactly how many combo boxes are going to be needed so i need it to cycle through them automaticaly, how do you call for them in a loop?
 
You need to use the TYPENAME property

For each ctl in FormName.controls
if typename(ctl) = "combobox" then
'stuff happens here
else
'other stuff / nothing happens here
end if
next

Rgds, Geoff

Never test the depth of water with both feet

Help us to help you by reading FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top