|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub ykcbf() '//2025.3.27
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("清单")
- arr = .UsedRange
- For i = 3 To UBound(arr)
- If Val(arr(i, 1)) Then
- If .Cells(i, 2).Interior.ColorIndex Then d(arr(i, 2)) = ""
- End If
- Next
- End With
- With Sheets("Sheet2")
- r = .Cells(Rows.Count, 1).End(3).Row
- For i = 1 To r
- Set Rng = .Cells(i, 1)
- s = Rng.Value
- If Not d.exists(s) Then
- Rng.Cells.Interior.ColorIndex = 4
- Else
- Rng.Cells.Interior.ColorIndex = 3
- End If
- Next
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|