excel光标所在行自动变色

2024年12月01日 09:54
有1个网友回答
网友(1):

在“Sheet1”标签上点击右键,然后点“查看代码”,然后把这段代码考进去:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next
Cells.ClearFormats
ActiveCell.Select
Selection.EntireRow.Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End Sub