“工作表”右键,“查看代码”,
VBA代码编辑器中,选择“Worksheet”
在Worksheet_SelectionChange函数中添加如下代码:
Target.Parent.Cells.Interior.ColorIndex = xlNone Target.EntireColumn.Interior.ColorIndex = 36 Target.EntireRow.Interior.ColorIndex = 36
最后整个函数如下:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Target.Parent.Cells.Interior.ColorIndex = xlNone Target.EntireColumn.Interior.ColorIndex = 36 Target.EntireRow.Interior.ColorIndex = 36 End Sub
保存,关闭即可。
效果:
时间: 2024-10-30 05:12:47