Dim 计数
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
数组 = {"李欢", "龚丽", "谭显亮", "王涛", "徐荣辉", "刘烨", "郑权恒", "廖伟笑迅吵", "郭威", "李襑"}
计数 = 数组.Count
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim 随机 = New Random().Next(数组碰侍.Count)
Do
If 数组(随机) <>"" Then
计数 -= 1
Me.Text = 数组(随机) &计数
数组(随机) = ""昌闭
Exit Do
Else
随机 = New Random().Next(数组.Count)
End If
Loop While (计数 >1)
End Sub
用VBA代码(我设置的抽签1-100,不会有重复),如含猜隐下:
Sub cq()
Range("c3:e3").ClearContents
Dim i As Byte
i = 3
T1:
Do While i <6
If Cells(3, i) = "谈厅" Then
Cells(3, i) = Application.RandBetween(1, 100)
End If
i = i + 1
Loop
If Application.Or(Cells(3, 3) = Cells(3, 4), Cells(3, 3) = Cells(3, 5), Cells(3, 4) = Cells(3, 5)) Then
Range("c3:e3").ClearContents
GoTo T1
End If
End Sub
效果如下(若图片没有动画,请兆腔点一下图片)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)