Keep Today() date when workbook closed

tsymic

New Member
Joined
Oct 1, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I have a work order that I would like to be able to reopen and have the same date as when the work order was written. I'm not sure if I should create a macro, or is there a formula I can use?

I don't want whoever is creating the work order to have to enter the date in the cell. I have today() currently, but if the work order is reopened a week down the road, the date is now wrong. I'm not sure if there is anything I can do.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
What is the sheet name and cell where today() is entered?
 
Upvote 0
The sheet is saved as the work order number and the today() is entered in the cell below the work order number.
1646331912698.png
 
Upvote 0
Place this macro in the code module for ThisWorkbook. Do the following: Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the left hand pane, double click on "ThisWorkbook". Copy/paste the macro into the empty window that opens up. Close the window to return to your sheet. Save the file as a macro-enabled file, close it and re-open it. If the date in P7 in the "Work Order" sheet does not equal the current date, the formula will be overwritten by the same date as when the work order was written.
VBA Code:
Private Sub Workbook_Open()
    If Sheets("Work Order").Range("P7") <> Date Then
        Sheets("Work Order").Range("P7").Value = Sheets("Work Order").Range("P7").Value
    End If
End Sub
 
Upvote 0
Solution
Should I put this before or after the macro I already have for everything else going on on this work book? Or does that kind of thing matter?

I really appreciate your help!
 
Upvote 0
Follow my instructions in Post #4 to put it in the code module for ThisWorkbook. As long as you don't have any other Workbook_Open macro in the code module for ThisWorkbook, hopefully, it won't create any problem.
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top