VBA Conditional Formatting if Cell Not Between

前端 未结 1 1799
一整个雨季
一整个雨季 2021-01-16 12:42

I need to apply conditional formatting to a cell using VBScript to change the background color of the cell if it\'s value is not between the value of two other cells:

<
相关标签:
1条回答
  • 2021-01-16 13:02

    The code that worked

    Set rng = objWorkSheet.Range("K" & rowNum + 2)
    
    'vbscript doesn't support named arguments, only positional
    Set fc = rng.FormatConditions.Add(1, 2, _
                                     "=$I$" & finalRowNum, _
                                     "=$J$" & finalRowNum)
    fc.SetFirstPriority
    
    With fc.Interior
        .PatternColorIndex = -4105
        .Color = 255
        .TintAndShade = 0
    End With
    
    fc.StopIfTrue = False
    
    0 讨论(0)
提交回复
热议问题