excel选定行变色

来源:互联网 发布:java设计模式书籍 编辑:程序博客网 时间:2024/05/21 14:18
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)    On Error Resume Next    Cells.FormatConditions.Delete    With Target.EntireRow.FormatConditions        .Delete        .Add xlExpression, , "TRUE"        .Item(1).Interior.ColorIndex = 36    End With    With Target.EntireColumn.FormatConditions        .Delete        .Add xlExpression, , "TRUE"        .Item(1).Interior.ColorIndex = 36    End WithEnd Sub

0 0