PDA

View Full Version : [SOLVED] Duplicate Comboboxes



Philcjr
09-01-2005, 12:53 PM
I have ten comboboxes that need to have the same value. They are named cbox_uom1, cbox_uom2, cbox_uom3...

How can I efficiently populate the lists all at the same time?

Here is my atempt... obviously it does not work.



For x = 1 To 10
With cbox_uomx
.AddItem "BAG"
.AddItem "BOX"
.AddItem "DRM"
.AddItem "EA"
.AddItem "In"
.AddItem "FT"
.AddItem "GAL"
.AddItem "LOT"
.AddItem "PK"
.AddItem "SET"
.AddItem "SHT"
End With
Next x


Any help would be appreciated

Phil

Norie
09-01-2005, 01:07 PM
Phil

Where are these comoboxes located?

Are they on a userform or a worksheet?

For a userform this might work.


For x = 1 To 10
With Me.Controls("cbox_uom" & x)
.AddItem "BAG"
.AddItem "BOX"
.AddItem "DRM"
.AddItem "EA"
.AddItem "In"
.AddItem "FT"
.AddItem "GAL"
.AddItem "LOT"
.AddItem "PK"
.AddItem "SET"
.AddItem "SHT"
End With
Next x

Philcjr
09-01-2005, 01:11 PM
Norie,

Thank you. Your code works perfectly.

The comboboxes are all on a userform

Thanks again
Phil