Sub TEST()
Dim MH, ST, TT$
For Each ST In [B!C2:C1000]
MH = 0
If ST <> "" Then MH = Application.Match(ST, [A!C2:C79], 0)
If IsError(MH) Then TT = TT & "," & ST
Next
If TT <> "" Then MsgBox "相異號碼如下:" & Mid(TT, 2)
End Sub作者: RCRG 時間: 2015-11-14 03:58
Sub TEST()
Dim MH, ST, TT$
For Each ST In [B!C2:C1000]
MH = 0
If ST <> "" Then MH = Application.Match(ST, [A!C2:C79], 0)
If IsError(MH) Then TT = TT & "," & ST
Next
For Each ST In [C!C2:C500]
MH = 0
If ST <> "" Then MH = Application.Match(ST, [A!C2:C79], 0)
If IsError(MH) Then TT = TT & "," & ST
Next
If TT <> "" Then MsgBox "相異號碼如下:" & Mid(TT, 2)
For Each ST In [B!C2:C1000]
MH = 0
If ST <> "" Then MH = Application.Match(ST, [A!C2:C79], 0)
If IsError(MH) Then
If InStr("," & TT & ",", "," & ST & ",") = 0 Then TT = TT & "," & ST
End If
Next
If TT = "" Then MsgBox "無相異" Else MsgBox "相異號碼如下:" & Mid(TT, 2)
If UBound(Filter(AR, E, True)) = 0 Then '陣列裡只有一個元素
T = T & IIf(T <> "", ",", "") & E
End If
End If
Next
If T <> "" Then
T = "相異號碼如下:" & vbLf & Replace(T, ",", vbLf)
Else
T = "查無相異號碼"
End If
MsgBox T
End Sub
複製代碼
作者: 准提部林 時間: 2015-11-17 15:27
借用超板的〔陣中陣〕:
Sub TEST()
Dim xD, SS, S
Set xD = CreateObject("Scripting.Dictionary")
For Each SS In Array([B!C2:C1000], [C!C2:C1000])
For Each S In SS
If S <> "" And Not xD.Exists(S & "") Then xD(S & "") = ""
Next: Next
For Each S In [A!C3:C79]
If xD.Exists(S & "") Then xD.Remove S & ""
Next
If xD.Count Then MsgBox "相異號碼如下:" & Join(xD.keys, ",") Else MsgBox "無相異"
End Sub