Private Sub cmdGetRandom_Click()
txtRandom = ""
Dim i, d As Integer
Dim sss As String
d = 0
For i = 1 To 10000
Me.txtRandom.SetFocus
sss = GetRandomNumber1(下限, 上限, 0)
If InStr(1, txtRandom, sss) > 0 Then
Else
txtRandom = txtRandom & sss & ";"
d = d + 1
End If
If d = 数量 Then
Call 排序
Exit Sub
End If
Next i
End Sub
Private Sub 排序()
Dim A
Dim i As Long, j As Long
Dim str As String
Dim n As Long
str = txtRandom
txtRandom = ""
For j = 0 To 7
A = Split(str, ";")
n = 21
For i = 0 To UBound(A, 1) - 1
If Val(A(i)) < n Then
n = A(i)
End If
Next
str = Replace(str, n & ";", "", 1, 1)
txtRandom = txtRandom & n & ";"
Next
End Sub
点击下载此附件