'自己修改,看看有没有重复的
Private Sub Command1_Click()
Dim dic, n, a
Set dic = CreateObject("scripting.dictionary")
Do While True
Randomize
a = Int(120 * Rnd) + 1
If Not dic.Exists(a) Then
dic.Add a, ""
n = n + 1
End If
If n = 120 Then Exit Do
Loop
a = dic.keys
Text1 = Join(a, ",")
End Sub
温馨提示:答案为网友推荐,仅供参考