Excel 怎么设置 选中一个单元格后,整行⼀整列的颜色都变化

2025-03-12 16:17:26
推荐回答(1个)
回答1:

使用工作表事件吧

vba实现

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.ScreenUpdating = False
    ActiveSheet.Cells.Interior.ColorIndex = 0
    Target.EntireRow.Interior.ColorIndex = 3
    Target.EntireColumn.Interior.ColorIndex = 3
    Application.ScreenUpdating = True
End Sub