VBA复合框去除多余项 10
展开全部
Private Sub UserForm_Initialize()
Dim i, j, m, clc, Flag As Single
For i = 1 To 10
ComboBox1.AddItem Application.WorksheetFunction.RandBetween(1, 10)
Next
Flag = 1
clc = ComboBox1.ListCount
Do While Flag <= clc
1:
For i = 2 To ComboBox1.ListCount
For j = 1 To i - 1
If ComboBox1.List(j - 1) = ComboBox1.List(i - 1) Then
ComboBox1.RemoveItem (i - 1)
Flag = Flag + 1
GoTo 1
End If
Next
Next
Flag = Flag + 1
Loop
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询