how to write vb code for multiple combo boxes
Gocush gave you one way, but if you want to do it from code, Jake's answer
can be simplified somewhat, as there is only one combo, so need to loop
through
With ActiveSheet.OLEObjects("ComboBox1").Object
.Clear
.AddItem "Bob"
.AddItem "Lynne"
.AddItem "Amy"
.AddItem "Hannah"
.AddItem "Sita"
.ListIndex = 0
End With
Change the name to suit.
--
HTH
RP
(remove nothere from the email address if mailing direct)
"HFB" wrote in message
...
Okay, I'll go with that thanks.
Now for part two. Same situation, BUT there are about 15 options on the
list. I have 12 combo boxes that each need to display the 15 options. I
know how to do the code for each individual one, but not for all in one
hit.
I tried Jake's 'ctl' code thing and it didn't seem to work - I prolly did
something wrong...
"Bob Phillips" wrote:
I would have thought a check means yes, seems the logical value to me.
It's
what you get all the time in Excel, for instance ToolsOptionsGeneral,
and
the Gridlines checkbox, I have always assumed that to me yes I want
Gridlines.
--
HTH
Bob Phillips
"HFB" wrote in message
...
Okay. How does the user know what the check means? Or do I go with
the
theory that a check means yes and no check means no?
"Bob Phillips" wrote:
Because a checkbox only has two states, you can use one checkbox for
yes
and
no, same number of controls.
--
HTH
RP
(remove nothere from the email address if mailing direct)
"HFB" wrote in message
...
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
|