|
Option Explicit
Sub TEST2()
Dim ar, iStart&, i&, j&, r&, k&, Rng As Range, vTemp
Application.ScreenUpdating = False
r = Cells(Rows.Count, "I").End(xlUp).Row
ar = Range("I2:U" & r).Value
vTemp = [x1].Value: r = [x2].Value + 1
With Range("Y2").Resize(UBound(ar), UBound(ar, 2))
.Clear
.Interior.Color = xlNone
For j = 1 To UBound(ar, 2)
For i = r To UBound(ar)
If ar(i, j) = vTemp Then
iStart = i + r
For k = iStart To UBound(ar) Step r
If ar(k, j) = vTemp Then
With .Cells(k, j)
.Value = 1
.Interior.Color = vbYellow
End With
End If
Next k
Exit For
End If
Next i
Next j
End With
Application.ScreenUpdating = True
Beep
End Sub
|
|