在一个Excel工作表上添加超过1个时间戳
我有一些问题...
我有一个工作表可以跟踪CRM管道活动,并且更改的每个状态都会通过时间戳记录...但是,我不知道如何制作一个以上的时间戳记...
在这里条件:
单元格“ a”将为范围和触发,然后单元格“ b”将为 目标时间戳I。
- 目标时间戳
单元格“ p”将是范围和触发,然后单元格“ q”为目标时间戳iii。
单元格“ AA”将是范围和触发,然后单元格“ AB”将为目标时间戳IV。
范围和触发值可以为数字和/或文本。
这是我的工作表代码:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myTableRange1 As Range
Dim myTrigger1 As Range
Dim myUpdatedRange1 As Range
'Your data table range
Set myTableRange1 = Range("B6:B50000")
'Check if the changed cell is in the data tabe or not.
If Intersect(Target, myTableRange1) Is Nothing Then Exit Sub
'Stop events from running
Application.EnableEvents = False
'Column for the date/time
Set myTrigger1 = Range("B" & Target.Row)
'Column for last updated date/time
Set myUpdatedRange1 = Range("G" & Target.Row)
'Determine if the input date/time should change
If myTrigger1.Value = "" Then
myUpdatedRange1.Value = Now
End If
'Update the updated date/time value
myUpdatedRange1.Value = Now
'Turn events back on
Application.EnableEvents = True
End Sub
I have some issue...
I have a work sheet to track CRM pipeline activities and every status changed will be recorded by a time stamp... but, I don't know how to make more than one time stamp...
Here the condition:
Cell "A" will be as Range and Trigger, Then Cell "B" will be as
target timestamp I.Cell "G" will be as Range and Trigger, Then Cell "H" will be as target timestamp II.
Cell "P" will be as Range and Trigger, Then Cell "Q" will be as target timestamp III.
Cell "AA" will be as Range and Trigger, Then Cell "AB" will be as target timestamp IV.
The Range and Trigger Values can be as number and/or text.
This my Worksheet Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myTableRange1 As Range
Dim myTrigger1 As Range
Dim myUpdatedRange1 As Range
'Your data table range
Set myTableRange1 = Range("B6:B50000")
'Check if the changed cell is in the data tabe or not.
If Intersect(Target, myTableRange1) Is Nothing Then Exit Sub
'Stop events from running
Application.EnableEvents = False
'Column for the date/time
Set myTrigger1 = Range("B" & Target.Row)
'Column for last updated date/time
Set myUpdatedRange1 = Range("G" & Target.Row)
'Determine if the input date/time should change
If myTrigger1.Value = "" Then
myUpdatedRange1.Value = Now
End If
'Update the updated date/time value
myUpdatedRange1.Value = Now
'Turn events back on
Application.EnableEvents = True
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
工作表更改:多个时间戳列,
A Worksheet Change: Multiple Timestamp Columns