Some things for you to think about
Lot of redundant code removed, no need to .Select and both rows were getting the same CF
I rearranged the CF tests in a 'get out' order
I like .Color and .ColorIndex instead of Pattern, Tint and Shade so I changed since I was more familiar with them. Put them back if you prefer of course
Don't think you needed the "=LEN(TRIM(C3))>0" so I left it out
I think it's important to use .FormatConditions.Count
Option Explicit ' <<<<<<<<<<<<<<<<<<< Sub test2() With Worksheets("Blagoevgrad total") ' <<<<<<<<<< or specific sheet .Cells.FormatConditions.Delete With Application.Union(.Range("C4:N4"), .Range("C8:N8")) .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="=$A$4+200" .FormatConditions(.FormatConditions.Count).Interior.Color = vbRed .FormatConditions(.FormatConditions.Count).StopIfTrue = True .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="=$A$4+150" .FormatConditions(.FormatConditions.Count).Interior.ColorIndex = 15 .FormatConditions(.FormatConditions.Count).StopIfTrue = True .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="=$A$4+100" .FormatConditions(.FormatConditions.Count).Interior.ColorIndex = 24 .FormatConditions(.FormatConditions.Count).StopIfTrue = True .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="=$A$4+50" .FormatConditions(.FormatConditions.Count).Interior.ColorIndex = 20 .FormatConditions(.FormatConditions.Count).StopIfTrue = True End With .Select .Range("C2").Select End With End Sub




Reply With Quote
