excel光标所在行自动变色

2024-12-01 09:54:56
推荐回答(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