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.