【发布时间】:2022-07-14 14:19:06
【问题描述】:
当 AtiveCell 在 6 Row 后面时,我选择并更改 EntireRow 的内部颜色(绿色)。
我需要选择并更改 ActiveCell 所在行的“I”和“J”列的内部颜色 (Color = 9359529)。与此代码类似,但不需要整行,只需要 I 和 J 列。
Dim lTarget As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row >= 6 Then
If Not lTarget Is Nothing Then
lTarget.EntireRow.Interior.ColorIndex = 0
End If
Target.EntireRow.Interior.Color = 9359529
Set lTarget = Target
End If
End Sub
【问题讨论】: