EXCEL中,如何求出0247这四个数,组成的所有的三位数,并且显出来,请问具体如何操作。用函数还是用VBA
EXCEL中,如何求出A1为0247这四个数,组成的所有的三位数,并且在A2中显出来,请问具体如何操作。用函数还是用VBA...
EXCEL中,如何求出A1为0247这四个数,组成的所有的三位数,并且在A2中显出来,请问具体如何操作。用函数还是用VBA
展开
2个回答
展开全部
Sub jjj()
On Error Resume Next
Dim arr(6) As Double
arr(0) = 0: arr(1) = 2: arr(2) = 4: arr(3) = 7: arr(4) = 0: arr(5) = 2: arr(6) = 4
For i = 0 To 3
j = arr(i)
For ii = i + 1 To i + 3
jj = arr(ii)
n = n + 1
Dim r(3) As Double
r(0) = 0: r(1) = 2: r(2) = 4: r(3) = 7
For k = 0 To 3
If r(k) = j Then
r(k) = -1
End If
If r(k) = jj Then
r(k) = -1
End If
Next
Dim rr(3) As Double
m = 0
For kk = 0 To 3
If r(kk) <> -1 Then
m = m + 1
rr(m - 1) = r(kk)
End If
Next
Dim rrr(1) As Double
rrr(0) = rr(0)
rrr(1) = rr(1)
If n > 3 Then
Cells(2 * n - 1 - 6, 1) = j & jj & rrr(0)
Cells(2 * n - 6, 1) = j & jj & rrr(1)
End If
Next ii
Next
End Sub
On Error Resume Next
Dim arr(6) As Double
arr(0) = 0: arr(1) = 2: arr(2) = 4: arr(3) = 7: arr(4) = 0: arr(5) = 2: arr(6) = 4
For i = 0 To 3
j = arr(i)
For ii = i + 1 To i + 3
jj = arr(ii)
n = n + 1
Dim r(3) As Double
r(0) = 0: r(1) = 2: r(2) = 4: r(3) = 7
For k = 0 To 3
If r(k) = j Then
r(k) = -1
End If
If r(k) = jj Then
r(k) = -1
End If
Next
Dim rr(3) As Double
m = 0
For kk = 0 To 3
If r(kk) <> -1 Then
m = m + 1
rr(m - 1) = r(kk)
End If
Next
Dim rrr(1) As Double
rrr(0) = rr(0)
rrr(1) = rr(1)
If n > 3 Then
Cells(2 * n - 1 - 6, 1) = j & jj & rrr(0)
Cells(2 * n - 6, 1) = j & jj & rrr(1)
End If
Next ii
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询