作者:乔山办公网日期:
返回目录:office365
右键当前工百作表名称(度下方的标签)问---查看代码答--把下列代码复专制进去属即可!
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
.Parent.Cells.Interior.ColorIndex = xlNone
.EntireRow.Interior.Color = vbGreen
.EntireColumn.Interior.Color = vbCyan
.Interior.Color = vbRed
End With
End Sub
这个是你的聚光灯效果,一次设置永久生效的
那是因为你选中了“视图”菜单下面的“阅读模式”,你把他点掉就可以了
按ALT+F11,输入如下代码(建议复e799bee5baa6e59b9ee7ad94332制粘贴,不易出现手误):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.EntireColumn.Address = Target.Address Then
Cells.Interior.ColorIndex = xlNone
Exit Sub
End If
If Target.EntireRow.Address = Target.Address Then
Cells.Interior.ColorIndex = xlNone
Exit Sub
End If
Cells.Interior.ColorIndex = xlNone
Rows(Selection.Row & ":" & Selection.Row + Selection.Rows.Count - 1).Interior.ColorIndex = 10
Columns(Selection.Column).Resize(, Selection.Columns.Count).Interior.ColorIndex = 10
End Sub
自己可以改ColorIndex,直到出现满意的颜色。以下是截图: