- Sub text()
- Dim arr, d, d1, dk, r, c, str
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- With Sheets("单号")
- arr = .Range("A4:n" & .[a65536].End(xlUp).Row)
- For r = LBound(arr) To UBound(arr)
- str = ""
- For c = 2 To UBound(arr, 2)
- str = str & arr(r, c) & "-"
- Next
- If Not d.exists(str) Then
- d(str) = ""
- Else
- d1(str) = ""
- End If
- Next
- dk = d1.keys
- For x = LBound(dk) To UBound(dk)
- For r = LBound(arr) To UBound(arr)
- str = ""
- For c = 2 To UBound(arr, 2)
- str = str & arr(r, c) & "-"
- Next
- If str = dk(x) Then
- Range(Cells(r + 3, 1), Cells(r + 3, 14)).Font.ColorIndex = 3
- End If
- Next
- Next
- End With
- End Sub
复制代码 |