[英]Excel, Stop update NOW(), when other cell changed value or string
I've in a single row of excel Start Time, End Time, Duration & Status 我在excel的开始时间,结束时间,持续时间和状态中显示了一行
End time is being calculated using NOW(), function of excel. 结束时间是使用Excel函数NOW()计算的。 I want this to be stop updating value.
我希望这是停止更新值。 If status cell in the row is changed to Stop from Running.
如果行中的状态单元格更改为“停止运行”。 This Stop is being done by manually.
此停止是通过手动完成的。
A possible solution to this problem is to use drop-down lists with data validation. 解决此问题的可能方法是使用下拉列表进行数据验证。 (This can be done without VBA.)
(这可以在没有VBA的情况下完成。)
Data validation drop-down lists are always non-volatile, even if you choose a volatile value from the drop-down list. 即使您从下拉列表中选择易失性值,数据验证下拉列表也始终是非易失性的。
Simple example that you can use to apply to your spreadsheet: 您可以用来将其应用于电子表格的简单示例:
Assume cell A1
contains the formula = NOW()
, and that cell B1
is set up with data validation in the following way: 假设单元格
A1
包含公式= NOW()
,并且该单元格B1
通过以下方式进行了数据验证:
Now cell B1
will take a "snapshot" of NOW()
whenever you choose the only available option from the drop-down list, and it will keep that value indefinitely until you reselect from the drop-down. 现在,只要您从下拉列表中选择唯一可用的选项,单元格
B1
就会获取NOW()
的“快照”,并且它将无限期保留该值,直到您从下拉列表中重新选择。
Any cells that need NOW()
can instead just use $B$1
, which is basically just NOW()
but it is frozen in time until you reselect again from the drop-down list. 需要
NOW()
任何单元格都可以只使用$B$1
,这基本上只是NOW()
但是它会被冻结,直到您再次从下拉列表中重新选择。
This is a sneaky way to convert a volatile cell to a non-volatile one (without using VBA). 这是一种将易失性单元转换为非易失性单元(不使用VBA)的狡猾方法。
If you want to use vba, Range("A1").Value = Now() is essentially the Now formula that runs only when the macro is triggered. 如果要使用vba,则Range(“ A1”)。Value = Now()本质上是Now公式,该公式仅在触发宏时运行。
Of course, switch out Range("A1") with whatever cell you need the date. 当然,用您需要日期的任何单元格切换Range(“ A1”)。 Without seeing your code I can't offer any suggestions.
没有看到您的代码,我无法提供任何建议。 Personally I've used offset to select the paste location.
我个人已经使用offset选择粘贴位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.