Looping UserForm ComboBox

  • Thread starter Thread starter Owen
  • Start date Start date
O

Owen

Hi

I would like to use the code below in a loop so that i can populate numerous
ComboBoxes within my UserForm with the same list.

I am not sure how to go about this, and would appreciate any help.

Thanks

With ComboBox7
Dim MonthArray As Variant
MonthArray = Split("01|02|03|04|05|06|07|08|09|10|11|12|", "|")
ComboBox7.List = MonthArray
End With
 
Something like:

Option Explicit
Private MonthArray As Variant
Private Sub UserForm_Initialize()
MonthArray = Split("01|02|03|04|05|06|07|08|09|10|11|12|", "|")
Me.ComboBox1.list = MonthArray
Me.ComboBox2.list = MonthArray
Me.ComboBox3.list = MonthArray
Me.ComboBox4.list = MonthArray
Me.ComboBox5.list = MonthArray
End Sub

will do the job

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Thanks Graham...it did the trick.

Graham Mayor said:
Something like:

Option Explicit
Private MonthArray As Variant
Private Sub UserForm_Initialize()
MonthArray = Split("01|02|03|04|05|06|07|08|09|10|11|12|", "|")
Me.ComboBox1.list = MonthArray
Me.ComboBox2.list = MonthArray
Me.ComboBox3.list = MonthArray
Me.ComboBox4.list = MonthArray
Me.ComboBox5.list = MonthArray
End Sub

will do the job

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>





.
 
Back
Top