右键SHEET名,查看代码
复制代码
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
tr = Target.Row
tc = Target.Column
Rows(tr).Interior.ColorIndex = 41
Columns(tc).Interior.ColorIndex = 41
End Sub
41表示颜色代码,根据你喜好,修改41
打开vba双击左侧的sheet1,把下面的代码复制进去即可:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = 0
Target.EntireRow.Interior.ColorIndex = 28
Target.EntireColumn.Interior.ColorIndex = 28
End Sub
点击视图下的阅读模式