使用VBA对彩票进行分析-3D-排列3-排列5

Sub 按钮1_Click()
Dim wb As Workbook
Dim sht As Worksheet, sht1 As Worksheet
Dim arr
Dim dic As Object
Application.ScreenUpdating = False
Set sht1 = ThisWorkbook.Sheets("排五遗漏数据")
For j = 3 To 15 Step 3
    sht1.Range(sht1.Cells(2, j - 1), sht1.Cells(11, j)).ClearContents
Next

Set wb = Workbooks.Open(ThisWorkbook.path & "\排五.xlsx")
Set sht = wb.Sheets(1)
arr = sht.Range("a1").CurrentRegion
wb.Close False

c = 3
For j = 2 To 6
    For k = 0 To 9
        For i = UBound(arr) To LBound(arr) + 1 Step -1
            If arr(i, j) * 1 = k Then
                sht1.Cells(k + 2, c) = UBound(arr) - i
                sht1.Cells(k + 2, c - 1) = k
                Exit For
            End If
        Next
    Next
    c = c + 3
Next
For j = 2 To 14 Step 3
    ActiveSheet.Sort.SortFields.Clear
    ActiveSheet.Sort.SortFields.Add Key:=Range(Cells(2, j + 1), Cells(11, j + 1)), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    With ActiveSheet.Sort
        .SetRange Range(Cells(1, j), Cells(11, j + 1))
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
Next

Application.ScreenUpdating = True

End Sub



请添加图片描述
请添加图片描述
请添加图片描述
下载源码链接:(https://download.csdn.net/download/weixin_43050480/87211884)
PS:亲自测10期可以中2期,最多的时候中4期

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码猩

如果可以请支持我一下哟!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值