在“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