How to Copy an Excel Cell Value at a Specific Date and Time
Question details
The user needs to permanently preserve a formula's calculated result that was recorded during a specific time window, preventing the cell from reverting to zero after the window closes.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Capturing time-sensitive formula calculations automatically before they update or expire.
- Observed behavior
- The formula successfully displays the result during the specified time window, but automatically returns zero once the condition changes, causing the loss of the historical data.
Before applying VBA macros to your spreadsheet, ensure you save a copy of your workbook as an Excel Macro-Enabled Workbook (.xlsm) to prevent losing your custom code.
Use a VBA Macro to Copy and Paste as Value
Since standard formulas dynamically update based on current conditions, use a VBA script to freeze the value by copying the formula result and pasting it as a static value.
A standard Excel formula cannot permanently retain a previous result once its parameters (like time) change. By writing a VBA script triggered by a Workbook_Open event, you can force Excel to check the time when the file is opened and hardcode the value if the window has passed.
Press 'Alt + F11' on your keyboard to launch the Microsoft Visual Basic for Applications editor.
In the Project Explorer pane on the left, locate your file name and double-click on 'ThisWorkbook'.
Select 'Workbook' from the left dropdown above the code window, which automatically creates a 'Private Sub Workbook_Open()' event. Write your condition to check if the current time exceeds your limit, and if so, copy the target cell and paste it back using 'Selection.PasteSpecial Paste:=xlPasteValues'.
Save the file as a Macro-Enabled Workbook. The macro will automatically execute and capture the value the next time the workbook is opened within or after your time window.

Automate Value Capture with Power Automate
If you cannot rely on manually opening the workbook to trigger a macro, use Microsoft Power Automate to extract and save the value at a scheduled time without opening the file.
Manage Time-Sensitive Data Effectively with WPS Spreadsheet
WPS Office offers robust Spreadsheet capabilities, including full support for VBA macros, enabling you to automate data capture tasks and preserve time-sensitive values seamlessly without losing your conditional calculations.
- 1. Install WPS Office: Download and install WPS Office, then open your workbook using WPS Spreadsheet.
- 2. Enable Developer Tools: Navigate to the 'Developer' tab on the top ribbon and click on 'Visual Basic' to access the built-in VBA editor.
- 3. Add Your Macro: Double-click 'ThisWorkbook', paste your time-checking macro to copy and paste the cell as a static value, and save the file.

Frequently Asked Questions
Why does my Excel formula return zero after a specific time?
Standard Excel formulas are dynamic and recalculate whenever a change is made or the sheet refreshes. If your formula contains a time condition (such as IF(NOW() < Deadline)), it will automatically re-evaluate to false or zero as soon as the current time surpasses your specified deadline.
Can I freeze a formula result manually without using VBA?
Yes. If you are actively working in the spreadsheet before the time window closes, you can manually freeze the result. Simply select the cell, copy it (Ctrl+C), right-click, and select 'Paste Values' (or use Ctrl+Shift+V) to permanently overwrite the formula with its current calculated result.
Will a VBA Workbook_Open macro run if the computer is asleep or the file is closed?
No, a Workbook_Open event relies on the Excel application actively opening the workbook. If the file is closed during the time window, the event will not trigger until the next time you or an automated script physically opens the file.




