View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
MrScience MrScience is offline
external usenet poster
 
Posts: 21
Default Auto Fill Color of a particular Cell if conditions are put

Note: This assumes you have contiguous data in column "A." You can
modify as necessary.

Sub fillBasedOnValue()

Dim myCell As Variant
Set myCell = Range("A2")

Do While Not IsEmpty(myCell)
Set nextcell = myCell.Offset(1, 0)

Select Case myCell

Case 51 To 69
myCell.Interior.Color = vbYellow

Case 70 To 90
myCell.Interior.Color = vbGreen

Case Is 90
myCell.Interior.Color = vbRed

End Select

Set myCell = nextcell

Loop

MsgBox "File Done"

End Sub