下面的代码工作,并更改北进入时的偏移单元格,我也想让它改变,如果它的南,西或东,但我似乎可以找到一种方法来添加此。VBA多个IF值
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("A7:A26")
Set rng = Range("A7:A26")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
For Each cell In rng.Cells
If cell.Value = "North" Then
cell.Offset(0, 1).Interior.Color = RGB(0, 255, 0)
cell.Offset(0, 2).Interior.Color = RGB(0, 255, 0)
cell.Offset(0, 3).Interior.Color = RGB(0, 255, 0)
End If
Next
End If
End Sub
你想对每个方向使用相同的颜色或不同的颜色吗? –