|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
修改一下这个过程代码就好了
Sub 重复数据标黄提示重复的行号()
Dim i%, j%, s, brr, ss As String, x
Dim dic As Object, key, keys, items
Set dic = CreateObject("scripting.dictionary")
###身份证核验查重 - 副本 - 副本.rar
(200.96 KB, 下载次数: 0)
Sheet2.Activate
Cells.Interior.Color = vbWhite
Range("e2:e5001").ClearContents
x = 2
For i = 2 To Cells(Rows.Count, "C").End(xlUp).Row
key = Cells(i, 4)
dic(key) = dic(key) & "," & i
Next
For i = 2 To Cells(Rows.Count, "C").End(xlUp).Row
key = Cells(i, 4)
brr = Split(dic(key), ",")
s = ""
For j = 1 To UBound(brr)
If brr(j) <> i Then
s = s & "," & brr(j)
If UBound(brr) <= 2 Then
ss = "与第" & Mid(s, 2) - 1 & "行重复"
Else
ss = ss & "与第" & Mid(s, x) - 1 & "行重复"
x = x + 2
End If
Cells(i, 5).Interior.Color = vbYellow
Cells(i, 3).Interior.Color = vbYellow
Cells(i, 5) = ss
End If
Next
ss = ""
x = 2
Next
End Sub
|
|