|
把所有等抽的老师放在G列。。。。。。。。。。。。- Private Sub CommandButton1_Click()
- With CommandButton1
- .Caption = IIf(.Caption = "开始", "停止", "开始")
- For i = 1 To 1000000
- DoEvents
- If .Caption = "开始" Then Exit For
- Call tt
- Next
- .Caption = "开始"
- End With
- End Sub
- Sub tt() '在[b2:c9]随机产生监考老师(不重复)
- arr = Range("g2:g" & [g65536].End(3).Row) '所有监考老师
- Dim brr(1 To 8, 1 To 2)
- p = UBound(arr)
- For i = 1 To 8
- For j = 1 To 2
- x = Int(Rnd * p + 1)
- brr(i, j) = arr(x, 1)
- arr(x, 1) = arr(p, 1)
- p = p - 1
- If p = 0 Then GoTo aa
- Next
- Next
- aa:
- [b2:c9] = brr
- End Sub
复制代码 |
|