Sub 排列3()
Range("D2:E999").ClearContents
j = 1
For i = 2 To [a65536].End(xlUp).Row
If Cells(i, "C").Value = "P" Then
'For Each k In Array(123, 132, 213, 231, 312, 321)
For k = 1000 To 1999
a = Cells(i, "A")
xA = 7 ^ Mid(a, 1, 1) + 7 ^ Mid(a, 2, 1) + 7 ^ Mid(a, 3, 1)
xK = 7 ^ Mid(k, 2, 1) + 7 ^ Mid(k, 3, 1) + 7 ^ Mid(k, 4, 1)
If xA = xK Then
j = j + 1
Cells(j, "D") = Mid(k, 2, 3)
Cells(j, "E") = Cells(i, "B")
End If
Next k
Else
j = j + 1
Cells(j, "D") = Cells(i, "A")
Cells(j, "E") = Cells(i, "B")
End If
Next i
End Sub作者: eric7765 時間: 2019-3-4 18:08