Originally Posted by
Bryan Hessey
A slight mod to the code supplied by L. Howard Kittle to remove errors, and to allow for the last (few) figures being deleted.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim lr As Integer
Dim rng As Range
Dim Cell As Range
lr = Cells(Rows.Count, "e").End(xlUp).Row
Set rng = Range("e2:e" & lr + 200)
rng.Interior.ColorIndex = 0 ' clear beyond last
Set rng = Range("e2:e" & lr)
For Each Cell In rng
On Error Resume Next
If Cell.Value = Application.Large(rng, 1) Then
Cell.Interior.ColorIndex = 5 ' dark blue
Else
If Cell.Value = Application.Large(rng, 2) Then
Cell.Interior.ColorIndex = 4 ' green
Else
If Cell.Value = Application.Large(rng, 3) Then
Cell.Interior.ColorIndex = 6 ' yellow
Else
If Cell.Value = Application.Large(rng, 4) Then
Cell.Interior.ColorIndex = 7 'viloet
Else
If Cell.Value = Application.Large(rng, 5) Then
Cell.Interior.ColorIndex = 8 'light blue
Else
End If
End If
End If
End If
End If
NextCell:
On Error GoTo 0
Next
End Sub
Hope this helps
--
Bookmarks