右键sheet名,查看代码
复制下列代码
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Cells.Interior.ColorIndex = xlNone
Target.Offset(, 1 - Target.Column).Resize(1, 26).Interior.ColorIndex = 34
S = Target.Column
If Columns(S).Interior.ColorIndex = 34 Then
Columns(S).Interior.ColorIndex = 0
Else
Columns(S).Interior.ColorIndex = 34
End If
End Sub