右击工作表,选择查看代码,弹出VBA界面,直接将下边代码复制粘贴过来,最后关闭VBA界面即可。
代码如下:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
If Target.Count > 1 Then Set Target = Target.Cells(1)
Target.EntireColumn.Interior.ColorIndex = 6
Target.EntireRow.Interior.ColorIndex = 6
End Sub
致敬原创: