'Return result on conditional format

Im working on a excel script, that will import a CSV file, analyse the result and create a report based on the analyse.

The CSV file contain up to 12 measurement. and all have to be vertified before the mesurement can be confirmed and end up on the report.

I would like to use conditional format to analyze the result. And need to know if the conditional is OK or not OK.

So my question is: Is there a way to change a boolean, if the conditional goes from FALSE to TRUE using the FormatConditions(1).StopIfTrue = True

Here is a snip of the code.

'Add first rule
RangeLength.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
        Formula1:=LengthMin, Formula2:=LengthMax
RangeLength.FormatConditions(1).Interior.Color = RGB(255, 0, 0)
RangeLength.FormatConditions(1).StopIfTrue = True
        If FormatConditions(1) = True Then
            Range("D" & lastRow).Value = True
        End If

Edit:

Here are the full sub snip:

    Sub MultipleConditionalFormattingExample()



Dim RangeLength As Range
Dim sht As Worksheet
Dim lastRow As Long
Dim LengthMax As Variant, LengthMin As Variant

Set sht = Worksheets("Collection")
lastRow = sht.ListObjects("collectionData").Range.Rows.Count

LengthMax = Worksheets("Engine").Range("G3").Value
LengthMin = Worksheets("Engine").Range("G4").Value

'Create range object
Set RangeLength = Range("G2:G" & lastRow)
RangeLength.Select
'Delete previous conditional formats
RangeLength.FormatConditions.Delete
'Add first rule
RangeLength.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
        Formula1:=LengthMin, Formula2:=LengthMax
RangeLength.FormatConditions(1).Interior.Color = RGB(255, 0, 0)
'Add second rule
    RangeLength.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
            Formula1:=LengthMin
    RangeLength.FormatConditions(2).Interior.Color = vbBlue
'Add third rule
    RangeLength.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
            Formula1:=LengthMax
    RangeLength.FormatConditions(3).Interior.Color = vbYellow
    RangeLength.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
            Formula1:=LengthMax
Debug.Print ActiveSheet.Range("G4").Interior.Color & " should be blue"
Debug.Print ActiveSheet.Range("G5").Interior.Color & " should be red"
Debug.Print ActiveSheet.Range("G8").Interior.Color & " should be yellow"


End Sub

And here are the result of the immediate window:

16777215 should be blue
16777215 should be red
16777215 should be yellow

Hope someone can understand by problem and point me in the right direction.

Thanks dk.ties



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source