Dear loungers,
Since Excel doesn’t maintain conditional formatting as I would like – once new rows and columns are added it becomes unmanageable – I have got into the habit of having a bit of VBA to reset the conditional formatting rules. This works well in that on “pressing the button” the sheet’s formatting is as I want it and the rules are set. What then doesn’t work is that when editing the sheet the formatting doesn’t get applied properly, even though the rules look right; so I have to “press the button” each time to apply the formatting.
Well they don’t quite look right. The range isn’t always populated when I inspect the rules using Manage Rules. What is odd is that the range will sometimes populate and sometimes not as I move the slider on the right of my rules, so this may be a red herring.
The VBA code for each rules looks something like this in each case:
With .Range(“a6:r1001″) ‘ TEAL Header line – with a number for the action and a zero as the line within the action .Activate .FormatConditions.Add xlExpression, Formula1:=”=AND(ISNUMBER($a6),$b6=0)” .FormatConditions(5).StopIfTrue = True .FormatConditions(5).Font.ThemeColor = xlThemeColorDark1 .FormatConditions(5).Borders.LineStyle = xlContinuous .FormatConditions(5).Borders.TintAndShade = -0.249946592608417 .FormatConditions(5).Borders(xlLeft).ColorIndex = 31 .FormatConditions(5).Borders(xlRight).ColorIndex = 31 .FormatConditions(5).Borders(xlBottom).ColorIndex = 31 .FormatConditions(5).Borders(xlTop).ColorIndex = 1 .FormatConditions(5).Interior.Color = 10066176 End With
I also attach the sheet. Can I do something better?
Thank you…………….. liz