Initiating multiple combo boxes with the same values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
Hi,
I tried to implement this, i keep getting a 'data mismatch' error. How can
i resolve this?
 
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
 
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?
 
Carlee, Post your entire userform_initialize sub and I'll try to
figure out what's wrong. James
 
Back
Top