conditional formating

  • Thread starter Thread starter Harryd
  • Start date Start date
H

Harryd

I have used the code below, how do I run it for a table of existing data

Private Sub Worksheet_Change(ByVal Target As Range)

Dim icolor As Integer



If Not Intersect(Target, Range("A1:AA200")) Is Nothing Then

Select Case Target

Case 15000 To 20000

icolor = 4

Case 14000 To 14999

icolor = 43

Case 13000 To 13999

icolor = 10

Case 12000 To 12999

icolor = 6

Case 11000 To 11999

icolor = 44

Case 10000 To 10999

icolor = 45

Case 9000 To 9999

icolor = 46

Case 8000 To 8999

icolor = 3

Case Else

icolor = 2

End Select

Target.Interior.ColorIndex = icolor

End If

End Sub
 
Back
Top