excel十字交叉突亮显示

打开excel按照alt+F11(或者打开"开发模式,选择Visual Basic"),选择ThisWorkbook写入如下代码

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

效果如下
excel十字交叉突亮显示

选择另外存为xlsm格式即可
excel十字交叉突亮显示

猜你喜欢

转载自blog.51cto.com/songhl/2530903