View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Pivot Conditional Formatting

Sub Decorate()
Range("H14:H500").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add _
Type:=xlCellValue, _
Operator:=xlLess, _
Formula1:="=$I14"
Selection.FormatConditions(1) _
.Interior.ColorIndex = 3
Selection.FormatConditions.Add _
Type:=xlCellValue, _
Operator:=xlGreater, _
Formula1:="=$J14"
Selection.FormatConditions(2) _
.Interior.ColorIndex = 4
End Sub
Worked fine for me.


"Donica" wrote:

Range of Cells Conditional formatting based on:
I have data like this, 3 columns

H I J
1 1.67 1.37 2.00
2 4.63 1.37 2.00
3 2.17 1.25 1.50

If H1 is < I1 then color cell H1 Red
If H1 is J1 then color cell H1 Green
If H1 I1 and < J1 then cell H1 color Yellow
I need to continue this for all of H column Rage on a row by row basis, so
next would be column 2 calcs.

I got one part of this code to work, then it breaks - I think I need to have
more Pivot
language in it?
Sub Decorate()

Range("H14:H500").Select
Selection.FormatConditions.Delete

Selection.FormatConditions.Add Type:=xlExpression, _
Formula1:="=$H14 < $I14"
Selection.FormatConditions(1).Interior.ColorIndex = 3

'Breaks -----
Selection.FormatConditions.Add Type:=xlExpression, _
Formula2:="=$H14 $J14"
Selection.FormatConditions(1).Interior.ColorIndex = 4


Would really appreciate some ideas..

Thanks for help,

--
Regards,

Donica