Using VBA to apply conditional formatting to a range of cells

后端 未结 2 1474
半阙折子戏
半阙折子戏 2021-01-11 18:19

I would like to know how to access the column in conditional formatting titled \'Applies To\' and input my own conditions. I have included a screenshot for better reference.

相关标签:
2条回答
  • 2021-01-11 19:02

    The "applies to" is inherent in the Selection that the With block is performed on.

    0 讨论(0)
  • 2021-01-11 19:07

    You need to do something like this (Range("A25") is exactly what you are going to find):

    With Range("A25")
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, _
                Formula1:="=" & c.Address 
            '.
            '.
            '.
    End With
    

    and there is no need to write "=" & c.Address & "=TRUE", you can use just "=" & c.Address.

    0 讨论(0)
提交回复
热议问题