Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wrote this to work with ComboBoxes on a UserForm. If you have them on a
Worksheet, the syntax will be slightly different: Dim ctl As OLEObject For Each ctl In OLEObjects If TypeOf ctl.Object Is MSForms.ComboBox Then If ctl.Name Like "drill*" Then ctl.Object.AddItem "Yes" ctl.Object.AddItem "No" End If End If Next ctl -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] HFB wrote: Jake - assuming I enter the code in as written - this does not work. No errors or anything, but not values in the combo boxes either. Is some of what you've written supposed to be replaced with something else according to my requirements? thank "Jake Marx" wrote: HFB, If you must create them as ComboBoxes and not CheckBoxes (not sure why CheckBoxes would be any bigger), here's a way: Dim ctl As Control For Each ctl In Controls If TypeOf ctl Is MSForms.ComboBox Then If ctl.Name Like "drill*" Then ctl.Object.AddItem "Yes" ctl.Object.AddItem "No" End If End If Next ctl -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] HFB wrote: Yeah, they will only contain yes and no. I don't actually have enough space in the form to do check boxes. "Bob Phillips" wrote: Will these boxes only contain Yes and No? If so, why not just use a checkbox? -- HTH RP (remove nothere from the email address if mailing direct) "HFB" wrote in message ... I have several combo boxes with names: drill1, drill2, drill3 etc. I want to write code that gives a Yes option and a No option in each of those boxes without having to write code for each one. Is there a way to do this? thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Getting Combo boxes to change options based on other Combo boxes. | New Users to Excel | |||
multiple combo boxes | Excel Discussion (Misc queries) | |||
Multiple combo boxes with unique duplicates showing only | New Users to Excel | |||
multiple combo boxes | Excel Discussion (Misc queries) | |||
Adding the same content to multiple combo boxes | Excel Programming |