excel:在1-30中,任选6个彼此不同的数进行组合,如何列出所有的组合

2024-12-15 13:04:47
推荐回答(2个)
回答1:

Sub 列出全任意30选6组合()
Application.ScreenUpdating = False
ww = 2
For m1 = 1 To 25

For m2 = m1 + 1 To 26

For m3 = m2 + 1 To 27

For m4 = m3 + 1 To 28

For m5 = m4 + 1 To 29

For m6 = m5 + 1 To 30
Cells(ww, 1).Value = m1
Cells(ww, 2).Value = m2
Cells(ww, 3).Value = m3
Cells(ww, 4).Value = m4
Cells(ww, 5).Value = m5
Cells(ww, 6).Value = m6
ww = ww + 1

Next
Next
Next
Next
Next
Next
Application.ScreenUpdating = True

End Sub

别忘了给分啊!

回答2:

个灌灌灌灌灌