Initiating multiple combo boxes with the same values

C

Carlee

Hello,
I have a number of combo boxes on a UserForm all requiring the same values
for hte user to select. Is there an efficient way for me to populate the
select options for each combo box, rather, than initializing each combo box
on the forms initialize event?
 
Z

Zone

If you want the same values in each combobox and you want the same
listindex selection for all, something like this should work:

Private Sub UserForm_initialize()
Dim cmb As ComboBox
For Each cmb In Me.Controls
With cmb
.AddItem "a"
.AddItem "b"
.ListIndex = 1
End With
Next cmb
End Sub

James
 
C

Carlee

Hi,
I tried to implement this, i keep getting a 'data mismatch' error. How can
i resolve this?
 
Z

Zone

Carlee, it worked fine for me. Did you copy and paste? Are you using
Excel XP (2002 or 2003)? Also, be sure the Control Source property is
set to empty. James
 
C

Carlee

Hi,
So, the errror 'Type mismach 13' is occuring when i click a on my Main Menu
UserForm, to open my StockpileDump data entry form, the form to which i am
trying to initialize. No control source properties contain any data.

Any further suggestions i could test?
 
Z

Zone

Carlee, Post your entire userform_initialize sub and I'll try to
figure out what's wrong. James
 

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

Top