If Sheets("选号").Range("Lianhao") = False Then GoTo repeat1
Me.Hide
Sheets("选号").Activate
strMsg = MsgBox("第" & i & "注号码生当作了 , 你可以选择保留号码到表格," & vbCrLf _
& "或从头生当作该注号码 。 是否保留?", vbYesNo, "保留号码")
If strMsg = vbYes Then
'保留到表格中
Sheets("选号").Select
Sheets("号码").Cells(i, 1) = Cells(1, 1)
Sheets("号码").Cells(i, 2) = Cells(1, 2)
Sheets("号码").Cells(i, 3) = Cells(1, 3)
Sheets("号码").Cells(i, 4) = Cells(1, 4)
Sheets("号码").Cells(i, 5) = Cells(1, 5)
Sheets("号码").Cells(i, 6) = Cells(1, 6)
Sheets("号码").Cells(i, 7) = Cells(1, 7)
Exit Do
If
repeat1:
Loop
Next
Sheets("号码").Activate
Sub
文章插图
8第七 , 接着点击插入——模块——然后在模块那边输入如下VBA代码:
Public Sub 随机生当作号码()
Dim intMax As Integer, intMzhs As Integer, i As Integer
intMax = frmCp.txtMax.Value '最大号码
intMzhs = frmCp.txtMzhs.Value '每注号数
For i = 1 To intMzhs
Randomize
Sheets("选号").Cells(1, i) = Int(intMax * Rnd + 1)
Next
Sub
Public Sub 判定反复()
Dim intMzhs As Integer, i As Integer, j As Integer
intMzhs = frmCp.txtMzhs.Value '每注号数
For i = 1 To intMzhs - 1
For j = i + 1 To intMzhs
If Sheets("选号").Cells(1, i) = Sheets("选号").Cells(1, j) Then
Sheets("选号").Range("Sfcf") = False
Exit Sub
If
Next j
Next i
Sheets("选号").Range("Sfcf") = True
Sub
Public Sub 判定幸运号()
Dim intXyh(3) As Integer, intMzhs As Integer
Dim x(3) As Boolean, i As Integer, intTemp As Integer
Dim j As Integer
intMzhs = frmCp.txtMzhs.Value '每注号数
intXyh(1) = frmCp.txtXyh1.Value '幸运号
intXyh(2) = frmCp.txtXyh2.Value '幸运号
推荐阅读
- word表格复制到Excel怎样做不变样
- QQ怎么绑定基友关系
- 手机QQ如何设置亲密关系
- Excel对表格中不同位置同一颜色求平均数、和
- 狗粮的吃法
- 《极简学理财》:一本适用于新手小白理财的入门指南书
- 理财经理随时可以使用的6大成交技巧
- 怎样对付不讲理的泼妇
- 怎样做当归生姜羊肉汤
- 抢红包软件哪个好用