'这么麻烦,只能用VBA了,就是排列组合。
Sub arrange()
Dim str, str1, str2, str3, str4, str5, cnt, cut
str = "123456"
Count = 0
cnt = 1
cut = 1
For i = 1 To Len(str)
str1 = Replace(str, Mid(str, i, 1), "")
For j = 1 To Len(str1)
str2 = Replace(str1, Mid(str1, j, 1), "")
For k = 1 To Len(str2)
str3 = Replace(str2, Mid(str2, k, 1), "")
For l = 1 To Len(str3)
str4 = Replace(str3, Mid(str3, l, 1), "")
For m = 1 To Len(str4)
str5 = Replace(str4, Mid(str4, m, 1), "")
For n = 1 To Len(str5)
Cells(cnt, cut) = Mid(str, i, 1) & Mid(str1, j, 1) & Mid(str2, k, 1) & Mid(str3, l, 1) & Mid(str4, m, 1) & Mid(str5, n, 1)
cnt = cnt + 1
Count = Count + 1
If cnt = 61 Then
cnt = 1
cut = cut + 1
End If
Next
Next
Next
Next
Next
Next
MsgBox Count
End Sub
不懂vba就不好办了,你看下附件吧。Alt+F11可打开代码窗口。
用如下VBA程序
Private Sub CommandButton1_Click()
Dim i1%, i2%, i3%, i4%, i5%, i6%, k As Long
Range("A:A").ClearContents
k = 0
For i1% = 1 To 6
For i2% = 1 To 6
For i3% = 1 To 6
For i4% = 1 To 6
For i5% = 1 To 6
For i6% = 1 To 6
If i1% <> i2% And i1% <> i3% And i1% <> i4% And i1% <> i5% And i1% <> i6% _
And i2% <> i3% And i2% <> i4% And i2% <> i5% And i2% <> i6% _
And i3% <> i4% And i3% <> i5% And i3% <> i6% _
And i4% <> i5% And i4% <> i6% And i5% <> i6% Then
k = k + 1
Range("A" & k) = i1% & i2% & i3% & i4% & i5% & i6%
End If
Next i6%
Next i5%
Next i4%
Next i3%
Next i2%
Next i1%
End Sub
给个图片或者附件吧?