【发布时间】:2015-09-03 15:05:19
【问题描述】:
如何自动突出显示突出显示活动单元格的整行而不删除突出显示的其他单元格? (我想在有活动单元格时突出显示整行,然后在我离开时取消突出显示。)t
我知道下面的 VBA 代码可以做到这一点,但它消除了所有其他用颜色填充的单元格。
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
' Clear the color of all the cells
Cells.Interior.ColorIndex = 0
With Target
' Highlight the entire row and column that contain the active cell
.EntireRow.Interior.ColorIndex = 8
End With
Application.ScreenUpdating = True End Sub
【问题讨论】: