|

楼主 |
发表于 2024-6-19 21:59
|
显示全部楼层
不删除,把重复行加颜色
Sub Adele()
Dim d As Object, Rng As Range
On Error Resume Next
Set d = CreateObject("scripting.dictionary")
With Worksheets("Sheet1")
r = .Cells(Rows.Count, 1).End(xlUp).Row
arr = .Range("a1:k" & r)
For x = 2 To UBound(arr)
s = arr(x, 2) & "+" & arr(x, 3) & "+" & arr(x, 4) & "+" & arr(x, 5) _
& "+" & arr(x, 6) & "+" & arr(x, 7) & "+" & arr(x, 8) & "+" & arr(x, 9) & "+" & arr(x, 10)
If Not d.exists(s) Then
d(s) = ""
Else
If Rng Is Nothing Then
Set Rng = .Rows(x)
Else
Set Rng = Union(Rng, .Rows(x))
End If
End If
Next x
If Not Rng Is Nothing Then
Rng.Interior.ColorIndex = 8
' Rng.Delete
End If
End With
End Sub |
|