请教多组框选项不重复问题
有combo1,Combo2,Combo3其列表分别都有“F1” “F2” “F3” “F4” “F5”“F6”
比如当Combo1显示的内容是F1时,其它二个Combo里面的F1就不能被选择
当Combo1显示的内容是F2时,其它二个Combo里面的F2就不能被选择
也就是说三个组合框的显示内容,在任何时候都不能被选择为相同的值。
Option Explicit Private vKey As Variant Private Sub Combo1_Click() Combo2.Clear Dim i& For i& = LBound(vKey) To UBound(vKey) If Combo1.ListIndex <> i& Then Combo2.AddItem vKey(i) End If Next End Sub Private Sub Combo2_Click() Combo3.Clear Dim i& For i& = LBound(vKey) To UBound(vKey) If Combo1.ListIndex <> i& And Combo2.ListIndex <> i& Then Combo3.AddItem vKey(i) End If Next End Sub Private Sub Form_Load() vKey = Array("F1", "F2", "F3", "F4", "F5", "F6") Combo1.Text = vbNullString Combo2.Text = vbNullString Combo3.Text = vbNullString Dim i& For i& = LBound(vKey) To UBound(vKey) Combo1.AddItem vKey(i) Next End Sub