|
需求太唤y, 含糊做一下
- Sub TEST()
- Dim R&, xD, i&, j&, k%, xR As Range, xH As Range
- Columns("AJ").Resize(, 221).Clear
- Set xD = CreateObject("Scripting.Dictionary")
- R = Cells(Rows.Count, 2).End(xlUp).Row
- Application.ScreenUpdating = False
- [AJ1].Resize(R).Interior.ColorIndex = 6
- For i = 1 To 29
- For j = 1 To R
- If Cells(j, i + 1).Interior.ColorIndex <> xlNone Then xD(i & "_" & Cells(j, i + 1)) = 1
- Next j
- Next i
- Set xH = [AK1]
- For i = 1 To 20
- For j = 1 To R
- Set xR = [L1].Cells(j, i)
- For k = 1 To 10
- If xD(i + k - 1 & "_" & xR) <> 1 Then GoTo 101
- xH(j, k) = xR
- If xR.Interior.ColorIndex <> xlNone Then xH(j, k).Interior.ColorIndex = xR.Interior.ColorIndex
- 101: Next k
- Next j
- xH(1, 11).Resize(R).Interior.ColorIndex = 6
- If i < 20 Then Set xH = xH(1, 12)
- Next i
- End Sub
复制代码
Xl0000324.rar
(100 KB, 下载次数: 1)
|
|