Excel now()不应该更新现有的时间戳 [英] Excel now() shouldn't update existing timestamp
问题描述
我有一个excel公式 = IF(NOT(ISBLANK(A2)),TEXT(NOW(),mm / dd / yyyy HH:ss),)
I have an excel formula =IF(NOT(ISBLANK(A2)), TEXT(NOW(), "mm/dd/yyyy HH:ss"),"")
我的问题是:当然,每次打开此工作表,它会更新与最新时间戳相关联的单元格值。如果它已经存在,我不希望这个时间戳更改。
My Problem is: Of course, everytime I open this sheet it updates the cell value associated with most recent timestamp. I do not want this timestamp to change if it already existed.
我想要的是某种方式:如果A2不是空白的,最近没有更新,那么不要更新时间戳否则更新。
What I want is somehow: if A2 is not blank and wasn't updated recently then dont update the timestamp else update.
如果可能,我正在寻找一个内联函数。
I am looking for an inline function if possible.
谢谢
推荐答案
您可以使用VBA宏执行此操作:
You can do this with a VBA macro:
- 打开VBA编辑器(工具>宏> Visual Basic编辑器)
- 在左侧,右键单击Sheet1,然后选择查看代码
- 将以下内容复制到编辑器:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Row = 2 Then
If Target.Value = "" Then
Cells(2, 2).Value = ""
Else
Cells(2, 2).Value = Format(Now, "mm/dd/yyyy HH:mm:ss")
End If
End If
End Sub
如果你写的东西我nto cell A2,则时间戳将被写入单元格B2,当您删除A2时,B2也将被删除。时间戳不会自动更新。
If you write something into cell A2, then a timestamp will be written into cell B2, and when you delete A2, B2 will also be deleted. The timestamp won't be automatically updated.
这篇关于Excel now()不应该更新现有的时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!