|
- Sub tt()
- Dim x As Range
- Set d = CreateObject("scripting.dictionary")
- With Sheet2
- .UsedRange.Interior.ColorIndex = 0
- arr = .[a1].CurrentRegion
- For i = 2 To UBound(arr)
- d(arr(i, 1)) = 0
- Next
-
- With Sheet1
- .UsedRange.Interior.ColorIndex = 0
- For Each x In .UsedRange
- If Len(x) Then
- If d.exists(x.Value) Then
- xstr = xstr & "," & x.Address(0, 0)
- d(x.Value) = d(x.Value) + 1
- End If
- End If
- Next
- xstr = Mid(xstr, 2)
- If xstr <> "" Then .Range(xstr).Interior.ColorIndex = 3
- End With
-
- xstr = ""
- For i = 2 To UBound(arr)
- arr(i, 2) = d(arr(i, 1))
- If arr(i, 2) > 0 Then xstr = xstr & "," & Cells(i, 2).Address(0, 0)
- Next
- .[a1].CurrentRegion = arr
- xstr = Mid(xstr, 2)
- If xstr <> "" Then .Range(xstr).Interior.ColorIndex = 3
- End With
- End Sub
复制代码 |
评分
-
查看全部评分
|