|
发表于 2012-9-8 12:20
|
显示全部楼层
本楼为最佳答案
- Sub test()
- Dim arr, d1, d2
- Dim i As Long, j As Long, x As Long
- Cells.Interior.ColorIndex = xlNone
- i = Cells(Rows.Count, 1).End(xlUp).Row
- j = Cells(1, Columns.Count).End(xlToLeft).Column
- arr = Range(Cells(1, 1), Cells(i, j))
- Set d1 = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- For i = 1 To UBound(arr)
- d1.RemoveAll
- d2.RemoveAll
- For x = (j + 1) / 3 + 1 To (j + 1) * 2 / 3 - 1
- d1(arr(i, x)) = ""
- Next
- For x = (j + 1) * 2 / 3 + 1 To UBound(arr, 2)
- d2(arr(i, x)) = ""
- Next
- For x = 1 To (j + 1) / 3 - 1
- If d1.exists(arr(i, x)) And d2.exists(arr(i, x)) Then
- Cells(i, x).Interior.ColorIndex = 6
- End If
- Next
- Next
- Set d1 = Nothing
- Set d2 = Nothing
- End Sub
复制代码 |
评分
-
查看全部评分
|