Sub 随机数()
Dim str As String
Dim i, j, x As Integer
Range("A1").EntireColumn.ClearContents
str = 49
For j = 1 To 50
x = Int((50 - 1) * Rnd() + 1)
For i = 1 To 36
Do While WorksheetFunction.CountIf(Range(Cells(1, 1), Cells(1, i)), x) >0
x = Int((50 - 1) * Rnd() + 1)
Loop
Cells(1, i) = x
Next
Rows(1).Insert shift:=xlUp
Next
End Sub
Sub SuiJi()Dim S(1 To 30, 1 To 49) As Integer
For i = 1 To 30
For j = 1 To 49
S(i, j) = j
Next
Next
For i = 1 To 30
For j = 1 To 49
w = Int(Rnd() * 49) + 1
tmp = S(i, w)
S(i, w) = S(i, j)
S(i, j) = tmp
Next
For r = 1 To 7
ShuChu = ""
For c = 1 To 7
ShuChu = S(i, (r - 1) * 7 + c) &"," &ShuChu
Next
ShuChu = Left(ShuChu, Len(ShuChu) - 1)
Cells((i - 1) * 7 + r, 2) = ShuChu
Next
Range("A" &(i - 1) * 7 + 1 &":A" &(i - 1) * 7 + 7).Merge
Range("A" &(i - 1) * 7 + 1) = i
Next
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)