【发布时间】:2015-05-15 18:43:34
【问题描述】:
我正在尝试创建一个代码,如果 A:AE 中的任何单元格发生任何更改,它将更新“X”列中的日期值。更新功能必须只适用于同一行。例如,我对 A1 进行了更改,并且 X1 已更新。非常感谢!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim R1 As Range
Dim R2 As Range
Dim InRange As Boolean
Set R1 = Range(Target.Address)
Set R2 = Range("A:AE")
Set InterSectRange = Application.Intersect(R1, R2)
InRange = Not InterSectRange Is Nothing
Set InterSectRange = Nothing
If InRange = True Then
R1.**Offset(0, 1)**.Value = Now()
End If
Set R1 = Nothing
Set R2 = Nothing
End Sub
【问题讨论】: