- Sub test()
- Dim tt
- tt = Timer
- Dim xx&, a&, i&, j&, k&, l&, m&, arr, brr
- xx = WorksheetFunction.Permut(11, 5)
- ReDim arr(1 To xx, 1 To 1)
- brr = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L")
- For i = 1 To 11
-
- For j = 1 To 11
- If j <> i Then
-
- For k = 1 To 11
- If k <> i And k <> j Then
-
- For l = 1 To 11
- If l <> i And l <> j And l <> k Then
-
- For m = 1 To 11
- If m <> i And m <> j And m <> k And m <> l Then
- a = a + 1
- arr(a, 1) = "A" & brr(i) & brr(j) & brr(k) & brr(l) & brr(m)
-
- End If
- Next m
- End If
- Next l
- End If
- Next k
- End If
- Next j
- Next i
- Sheet1.Range("a1").Resize(xx, 1) = arr
- MsgBox Timer - tt
- End Sub
复制代码
|