简体   繁体   English

Excel,当其他单元格更改值或字符串时,停止立即更新NOW()

[英]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.

相关问题 其他单元格值更改时如何将单元格值更新为“”? - How to update cell value to "" when other cell value changed? VBA Excel-根据其他单元格值更新单元格值 - VBA Excel - Update Cell value based on other cell value 更新单元格中的值,所有其他单元格将自动更改 - update a value in a cell and all other cells will be automatically changed 如何在Excel中基于其他单元格值更新单元格值 - How to update a cell value based on other cell values in excel 更改单元格时自动更新(计算)Excel工作表 - Auto-update (calculate) the Excel sheet when a cell is changed Excel-第一次更改另一个单元格时用日期时间更新列 - Excel - Update Column with Date Time when Another Cell is First Changed 如何使用NOW时间在Excel VBA中更新单元格以进行另一个单元格更新,而另一个单元格更新又是通过其他单元格更改来更新的? - How to update a cell in Excel VBA with NOW time for a another cell update which in turn was updated via other cell changes? Excel-从另一个单元格更改一个单元格的值,但清除输入单元格后更改的单元格将保留值 - Excel - Change the value of a cell from another cell, but changed cell keeps value when input cell is cleared Excel:如何根据更改单元格值的时间创建历史数据 - Excel: how to create historical data based on when cell value is changed VBA Excel-更改两个单元格的值时,彼此更改 - VBA excel - change two cell's values based on each other, when either cell is changed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM