I have the following code that I use to apply conditional formatting to a worksheet. The problem is, if I vary the value in Formula1:=Cells(11,7)
[for example], the formatted data does not reflect the updated change. When I open the Excel's Conditional Formatting Rules Manager, the rules do not show a reference to the actual cell, but the value of the cell at the time that I ran the macro. Any thoughts?
Dim i As Integer
For i = 7 To 13
Range(Cells(21, i), Cells(118, i)).Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
Formula1:=Cells(11, i)
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:=Cells(13, i)
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ColorIndex = 6
.TintAndShade = 0
End With
Next