|
Option Explicit
Sub TEST6()
Dim ar, i&, j&, k&, n&, dic As Object, strTxt$
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
strTxt = [C9].Value
For j = 1 To Len(strTxt) Step 2
dic(Mid(strTxt, j, 2)) = Empty
Next j
ar = Worksheets(1).Range("F2:I8").Value
For i = 1 To UBound(ar)
For j = 1 To UBound(ar, 2)
strTxt = ar(i, j): ar(i, j) = Empty: n = 0
For k = 1 To Len(strTxt) Step 2
If dic.exists(Mid(strTxt, k, 2)) Then n = n + 1
Next k
If InStr("4567", n) Then ar(i, j) = "000"
Next j
Next i
With Worksheets(2)
.UsedRange.ClearContents
.[C2].Resize(UBound(ar), UBound(ar, 2)) = ar
.Activate
End With
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
|