首页 > 解决方案 > VBA:文本下方的条件格式单元格

问题描述

我有一个包含表格格式数据的原始数据。如果任何单元格值包含可以出现在单元格中的任何位置的文本“紧急”,我需要突出显示连续的 6 行。

我写了一个代码,但没有为我工作。在这里,我使用“J”列进行硬编码。但是我的字符串可以出现在任何列中。

    With Cells
    .FormatConditions.Add Type:=xlExpression, Formula1:= _
      "=ISNUMBER(SEARCH(""Urgent*"",$J1))"
    With .FormatConditions(.FormatConditions.Count)
        .SetFirstPriority
        With .Interior
            .PatternColorIndex = xlAutomatic
            .Color = 7405514
            .TintAndShade = 0
        End With
        StopIfTrue = False
    End With

![excel] https://ibb.co/swkBbtY

标签: excelvbaformattingconditional-statements

解决方案


推荐阅读