|
赵刚老师昨天已经给出了代码,好像升级后给丢了- Sub Macro1()
- Dim d(1 To 2) As Object, arr(1 To 2), i&, l&, t
- For l = 1 To 2
- Set d(l) = CreateObject("scripting.dictionary")
- arr(l) = Sheets(l).[a1].CurrentRegion
- For i = 2 To UBound(arr(l))
- If arr(l)(i, 1) = 1 Then d(l)(arr(l)(i, 2)) = i
- Next
- Next
- For i = 2 To UBound(arr(1))
- If arr(1)(i, 1) = 1 Then
- If d(1).Exists(arr(1)(i, 2)) And d(2).Exists(arr(1)(i, 2)) Then
- d(1).Remove (arr(1)(i, 2))
- d(2).Remove (arr(1)(i, 2))
- End If
- End If
- Next
- For l = 1 To 2
- With Sheets(l)
- .[b:b].Interior.ColorIndex = xlNone
- t = d(l).Items
- For i = 0 To UBound(t)
- .Cells(t(i), 2).Interior.ColorIndex = 3
- Next
- End With
- Next
- End Sub
复制代码 |
|