|
Option Explicit
Sub TEST()
Dim ar, i&, dic As Object, Rng As Range
Set dic = CreateObject("Scripting.Dictionary")
ar = Sheets(1).[A1].CurrentRegion
For i = 2 To UBound(ar): dic(ar(i, 1)) = "": Next
Set Rng = [A1].CurrentRegion
With Rng
.Interior.ColorIndex = 0
ar = Rng
For i = 2 To UBound(ar)
If dic.exists(ar(i, 2)) Then
If ar(i, 4) <> "" Then
Cells(i, 1).Resize(, UBound(ar, 2)).Interior.Color = vbRed
ElseIf ar(i, 5) < 0 Then
Cells(i, 1).Resize(, UBound(ar, 2)).Interior.Color = vbRed
End If
End If
Next i
End With
Set dic = Nothing
Beep
End Sub
|
|