|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- r = .UsedRange.Find(what:="*", LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows, searchdirection:=xlPrevious).Row
- c1 = .Cells(1, 1).End(xlToRight).Column
- c2 = .Cells(1, .Columns.Count).End(xlToLeft).Column
- arr = .Range("a1").Resize(r, c2)
- For i = 2 To UBound(arr)
- If Len(arr(i, 2)) = 0 Or Len(arr(i, UBound(arr, 2))) = 0 Then
- Exit For
- End If
- d.RemoveAll
- For j = 2 To c1
- d(arr(i, j)) = j
- Next
- For j = c1 + 2 To c2
- If d.exists(arr(i, j)) Then
- .Cells(i, j).Interior.ColorIndex = 6
- .Cells(i, d(arr(i, j))).Interior.ColorIndex = 6
- End If
- Next
- Next
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|