R Ronnie Apr 30, 2008 #1 Is there a way to have a date automatically inserted the first time a document is opened and then not again?
Is there a way to have a date automatically inserted the first time a document is opened and then not again?
G Gord Dibben May 1, 2008 #2 Automatically......only by code. Manually, first time opened, select a cell and CTRL + ; Workbook_Open code that runs only if a cell is blank. Private Sub Workbook_Open() With Sheets("Sheet1").Range("A1") If .Value = "" Then ..Value = Format(Now, "mm/dd/yyyy hh:mm:ss") End If End With End Sub Of course the workbook has to be opened at least once in order to add the code to Thisworkbook module and saved. Next time opened, date added to A1 but not on subsequent openings. Gord Dibben MS Excel MVP
Automatically......only by code. Manually, first time opened, select a cell and CTRL + ; Workbook_Open code that runs only if a cell is blank. Private Sub Workbook_Open() With Sheets("Sheet1").Range("A1") If .Value = "" Then ..Value = Format(Now, "mm/dd/yyyy hh:mm:ss") End If End With End Sub Of course the workbook has to be opened at least once in order to add the code to Thisworkbook module and saved. Next time opened, date added to A1 but not on subsequent openings. Gord Dibben MS Excel MVP