天天看点

excel十字交叉突亮显示

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    Cells.FormatConditions.Delete
    With Target.EntireColumn
        .FormatConditions.Add xlExpression, , "=true"
        .FormatConditions(1).Interior.Color = RGB(253, 255, 200)
    End With
    With Target.EntireRow
        .FormatConditions.Add xlExpression, , "=true"
        .FormatConditions(2).Interior.Color = RGB(253, 255, 200)
    End With
End Sub