Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50076

Maintain conditional formatting on row deletion

$
0
0
I have a conditional formatting macro that I apply over many sheets, but this gets "broken" when a row within the range is deleted.

ie if my range to be conditional fomatting is A17:B190 and i delete A55, the conditional formatting rule changes to A17:B54;A55:B190

HOw can i hard code my conditional formatting so I can delete (and add) rows?

sample of my code:

Code:

With Range("Source")
          .FormatConditions.Add Type:=xlTextString, String:="EU Corporate", TextOperator:=xlContains
          .FormatConditions(.FormatConditions.Count).SetFirstPriority
          .FormatConditions(1).StopIfTrue = True
          With .FormatConditions(1).Interior
              .PatternColorIndex = xlAutomatic
              .Color = 10092288
              .TintAndShade = 0
          End With
    End With


Viewing all articles
Browse latest Browse all 50076

Trending Articles