comboboxes
Try the below code behind the userform after placing 5 comboboxes in your
userform.
Private Sub ComboBox1_DropButtonClick()
Fillcombo
End Sub
Private Sub ComboBox2_DropButtonClick()
Fillcombo
End Sub
Private Sub ComboBox3_DropButtonClick()
Fillcombo
End Sub
Private Sub ComboBox4_DropButtonClick()
Fillcombo
End Sub
Private Sub ComboBox5_DropButtonClick()
Fillcombo
End Sub
Sub Fillcombo()
Dim blnFound As Boolean, strTemp As String
strTemp = Me.ActiveControl.Object.Text
Me.ActiveControl.Object.Clear
Me.ActiveControl.Object.Text = strTemp
For intTemp = 1 To 5
blnFound = False
For Each ctrl In UserForm1.Controls
If TypeOf ctrl Is MSForms.ComboBox Then
If Me.ActiveControl.Name < ctrl.Name Then
If ctrl.Text = CStr(intTemp) Then blnFound = True: Exit For
End If
End If
Next ctrl
If blnFound = False Then _
Me.ActiveControl.Object.AddItem intTemp
Next
End Sub
If this post helps click Yes
---------------
Jacob Skaria
"aqualibra" wrote:
I have 5 comboboxes each has numbers 1 to 5
If combobox1 has 1 then the remaining boxes dropdown menu cannot show 1 and
so on.
There is no order in which the combobxes will be selected.
For eg: Combobox1 has been filled first with say option 4.
next I decide to fill combobox 4. The drop down menu for this should show on
1, 2, 3,5.
Is this possible.
Thanks.
|