I have posted before about conditional formatting and I have a piece of code that works for integer numbers but when I try to implement it for a cell that is formatted to percentages it doesn't work. The cells are also formatted with a formula. Sample workbook and code attached, I would greatly appreciated anyone who could help me.
Formula:
Sub ConditionalFormatting()
lLow = -3
lHigh = 50
Set rng = Range("H5:H19, H21:H24, H26:H29, H26:H29, H31:H36, H38:H44") 'Range
rng.FormatConditions.Delete ' delete any pre-existing formatting
' add greater than condition
With rng.FormatConditions.Add(xlCellValue, xlGreater, lHigh)
.Interior.Color = rgbRed
End With
' add less than condition
With rng.FormatConditions.Add(xlCellValue, xlLess, lLow)
.Interior.Color = rgbGreen
End With
' add middle condition
With rng.FormatConditions.Add(xlCellValue, xlBetween, lHigh, lLow)
.Interior.Color = rgbGold
End With
End Sub
Bookmarks