【发布时间】:2017-05-08 17:37:13
【问题描述】:
我找到了下面的代码,虽然它突出显示了整行,但它还从任何先前着色的单元格中删除了颜色。
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
Target.Parent.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
我想在选择单元格时突出显示整行(可能已经着色),但是当我移动到不同行中的单元格时,之前突出显示的行应该返回到之前的颜色。
有没有办法修改之前选择的单元格/行?
【问题讨论】: