简体   繁体   中英

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 在此处输入图片说明

在此处输入图片说明

End time is being calculated using NOW(), function of excel. 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.)

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:

在此处输入图片说明

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.

在此处输入图片说明

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.

This is a sneaky way to convert a volatile cell to a non-volatile one (without using VBA).

If you want to use vba, Range("A1").Value = Now() is essentially the Now formula that runs only when the macro is triggered.

Of course, switch out Range("A1") with whatever cell you need the date. Without seeing your code I can't offer any suggestions. Personally I've used offset to select the paste location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM