ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Links and Linking in Excel (https://www.excelbanter.com/links-linking-excel/)
-   -   Automatically enter today's date as a static entry (https://www.excelbanter.com/links-linking-excel/29251-automatically-enter-todays-date-static-entry.html)

David

Automatically enter today's date as a static entry
 
I have a need to automatically save the current date to a cell in an excel spreadsheet every time the sheet is saved.

Today() always returns the current date, so once I open the sheet on a new day I can no longer see the date the information was last updated, i.e. saved.

Any help would be appreciated.

mrscott

Hi David,

Easy to fix. Simply go to View--Header/Footer--click either Custom
Header or Custom Footer. From there you'll see several icons you can
select. Two of them are for inserting date and time. Select what you
need and viola! Problem solved.

David wrote:
I have a need to automatically save the current date to a cell in an excel spreadsheet every time the sheet is saved.

Today() always returns the current date, so once I open the sheet on a new day I can no longer see the date the information was last updated, i.e. saved.

Any help would be appreciated.



Bill Manville

You need a Workbook_BeforeSave event procedure.

Alt+F11 to the VB Editor

Double-click on the ThisWorkbook object in the Project Explorer

Select Workbook from the left-hand dropdown and BeforeSave from the
right-hand dropdown at the top of the main window.

Insert the following between the lines that appear
(Private Sub Workbook_BeforeSave... and End Sub):

ThisWorkbook.Sheets("Sheet1").Range("A1") = Date

adjust the sheet name and cell address appropriately.

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup



All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com