View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_498_] joel[_498_] is offline
external usenet poster
 
Posts: 1
Default VBA CODE FOR CONDITIONAL FORMULA


This code should work. You have to limit the range otherwise to go
through the entire worksheet takes a long time. There are more than one
shade of the colors and I picked the Standard shade for each of the
colors.

Const RedColor = 3
Const YellowColor = 6
Const OrangeColor = 46

Set DataRange = Range("A1:D500")

For Each cell In DataRange
If cell < "" And IsNumeric(cell) Then

Select Case cell
Case Is < 50
cell.Interior.ColorIndex = OrangeColor
Case Is < 120
cell.Interior.ColorIndex = YellowColor
Case Else
cell.Interior.ColorIndex = RedColor
End Select
End If
Next cell


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=168094

Microsoft Office Help