写了一段VBA程序,执行后,12个数据出现在A1:A12
Sub Get12in37()
Dim RN, I1, I2, X
I1 = 1
While I1 < 13
RN = Int(1 + Rnd * 37)
X = 0
For I2 = 1 To I1 - 1
If RN = Range("A" & I2) Then X = 1
Next
If X = 0 Then
Range("A" & I1) = RN
I1 = I1 + 1
End If
Wend
End Sub