请下载附件测试!
Sub abcabc()
Dim i As Integer, m As Integer, n As Integer
Dim x As Long, y As Integer
x = 2: y = 1
[a2:Z10000] = ""
If MsgBox("允许类似111111,111122这样的有重复数字的出现吗?", vbYesNo + vbInformation) = vbYes 判晌Then
For i = 1 To 9
For m = 1 To 9
For n = 1 To 9
Cells(x, y) = i & i & m & m & n & n
轿冲芦 y = y + 1
If y = 22 Then y = 1: x = x + 1
Next n, m, i
Else
For i = 1 To 7
For m = 1 To 8
If m = i Then GoTo mNext
For n = 1 To 9
If n = m Or n = i Then GoTo nNext
Cells(x, y) = i & i & m & m & n & n
y = y + 1
闭带 If y = 22 Then y = 1: x = x + 1
nNext: Next n
mNext: Next m
Next i
End If
End Sub