呵呵,知错就改,善莫大焉!
代码送上供测试
- Sub test2()
- Dim Arr, Dic, Fla As Boolean, Brr, Crr, a&, b%, i&, j%
- Set Dic = CreateObject("scripting.dictionary")
- Arr = [a1:a10001]
- Brr = [i1:r10000]
- Application.ScreenUpdating = False
- For i = 1 To UBound(Arr)
- Dic(Format(Arr(i, 1), "00000")) = ""
- Next i
- ReDim Crr(1 To 10000, 1 To 10)
- a = 1
- For i = 1 To UBound(Brr)
- For j = 1 To UBound(Brr, 2)
- Fla = False
- If Not Dic.exists(Format(Brr(i, j), "00000")) Then
- For k = 1 To 5
- If Val(Mid(Format(Brr(i, j), "00000"), k, 1)) <> Choose(k, 3, 2, 5, 1, 7) Then
- Fla = True
- Else
- Fla = False
- Exit For
- End If
- Next k
- If Fla Then
- b = b + 1
- Crr(a, b) = Brr(i, j)
- If b Mod 10 = 0 Then
- b = 0
- a = a + 1
- End If
- End If
- End If
- Next j
- Next i
- Set Dic = Nothing
- With Sheet2.[a1].Resize(a, 10)
- .Clear
- .NumberFormatLocal = "00000"
- .Value = Crr
- Sheet2.Activate
- End With
- Application.ScreenUpdating = True
- End Sub
复制代码
|