欢迎lw0851朋友 Sub seq() Application.ScreenUpdating = False Dim x As New Collection, a(1 To 15), b(1 To 10), x1, x2, x3, x4, x5, x6, x7, n, arr() Randomize For x1 = 1 To 33 x.Add x1 Next For x1 = 1 To 15 x2 = 1 + Int(Rnd * x.Count) a(x1) = x(x2) x.Remove x2 Next Set x = Nothing For x1 = 1 To 16 x.Add x1 Next For x1 = 1 To 10 x2 = 1 + Int(Rnd * x.Count) b(x1) = x(x2) x.Remove x2 Next ReDim arr(1 To 10 * WorksheetFunction.Combin(15, 6), 1 To 1) For x1 = 1 To 10 For x2 = x1 + 1 To 11 For x3 = x2 + 1 To 12 For x4 = x3 + 1 To 13 For x5 = x4 + 1 To 14 For x6 = x5 + 1 To 15 For x7 = 1 To 10 n = n + 1 arr(n, 1) = a(x1) & "," & a(x2) & "," & a(x3) & "," & a(x4) & "," & a(x5) & "," & a(x6) & "---" & b(x7) Next x7, x6, x5, x4, x3, x2, x1 [a1] = "A组:" & Join(a, ",") [a2] = "B组:" & Join(b, ",") [a4].Resize(n, 1) = arr [A:A].Columns.AutoFit Application.ScreenUpdating = True End Sub
|