6,210
社区成员
发帖
与我相关
我的任务
分享
'用B列来记录A列的最后修改时间
Dim r As Integer, c As Integer, v As String
Const DetectCol As Integer = 2, StartRow As Integer = 2, EndRow As Integer = 16, TimeCol As Integer = 4
Private Sub Worksheet_Change(ByVal Target As Range)
If c = DetectCol And r >= StartRow And r <= EndRow Then
'If Cells(r, c) <> v Then
Cells(r, TimeCol) = Now()
'End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
r = ActiveCell.Row
c = ActiveCell.Column
v = ActiveCell.Value
End Sub