我的代码有问题,我需要更改另一列-行
我试图建立宏,但是不能用它。
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xRg As Range
On Error Resume Next
Set xRg = Intersect(Target, Range("A6:U1000"))
If xRg Is "YES" Then Exit Sub
Range("G" & Target.Row).Value = "CHECK"
End Sub
当G列中的N6:N1000列为“是”时,将值更改为“检查”,并且所有A6行(例如U1000)都变为红色
答案 0 :(得分:0)
我不太了解您要在此处实现的目标,但希望以下内容可以大致满足您的需求。尝试一下,让我知道它是否不符合您的期望。
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Dim xRg As Range, cl as Range
Set xRg = Intersect(Target, Range("A6:U1000"))
If Not xRg Is Nothing Then
For Each cl In xRg.Cells
If cl.Value = "YES" Then Range("G" & cl.Row).Value = "CHECK"
Next
End If
Application.EnableEvents = True
End Sub