|
- Sub Macro1()
- Dim arr, rng As Range, i&, j%
- arr = Range("b11").CurrentRegion
- ActiveSheet.UsedRange.Interior.ColorIndex = xlNone
- For j = 1 To UBound(arr, 2)
- For i = 1 To UBound(arr) - 1
- If arr(i, j) = arr(i + 1, j) Then
- If rng Is Nothing Then
- Set rng = Cells(i + 10, j + 1).Resize(2, 1)
- Else
- Set rng = Union(rng, Cells(i + 10, j + 1).Resize(2, 1))
- End If
- End If
- Next
- Next
- If Not rng Is Nothing Then rng.Interior.ColorIndex = 3
- End Sub
复制代码 |
|