|
Sub 提示()
Application.ScreenUpdating = False
Dim ar As Variant, cr As Variant
Dim i As Long, r As Long, rs As Long
Dim br(), brr()
Dim d As Object
Set d = CreateObject("scripting.dictionary")
Set dc = CreateObject("scripting.dictionary")
With Sheets("sheet1")
r = .Cells(Rows.Count, 4).End(xlUp).Row
ar = .Range("d1:e" & r)
For i = 2 To UBound(ar)
If Trim(ar(i, 2)) <> "" Then
If Not dc.exists(ar(i, 1)) Then
If Not d.exists((ar(i, 2))) Then
d(ar(i, 2)) = ar(i, 1)
Else
d(ar(i, 2)) = d(ar(i, 2)) & "," & ar(i, 1)
End If
dc(ar(i, 1)) = ""
End If
End If
Next i
End With
For Each k In d.keys
If InStr(d(k), ",") > 0 Then
If ts = "" Then
ts = k & "有不一致信息"
Else
ts = ts & Chr(10) & k & "有不一致信息"
End If
End If
Next k
If ts = "" Then
w = "ok!"
Else
w = ts
End If
Application.ScreenUpdating = True
MsgBox w
End Sub
|
|