B Bob Pearce - Australia Sep 27, 2008 #1 When I open an Excel template worksheet, how can I get the date to automatically update in a cell?
D Dave Peterson Sep 27, 2008 #2 You could use a formula that changes to the current date -- no matter when it opens: =today() If you want date that doesn't change after the first time it's applied, you could use a macro: Option Explicit Sub auto_Open() With ThisWorkbook.Worksheets("Sheet1").Range("a1") If IsEmpty(.Value) Then .Value = Date End If End With End Sub This looks to see if A1 on Sheet1 is empty. If it is, it plops in today's date.
You could use a formula that changes to the current date -- no matter when it opens: =today() If you want date that doesn't change after the first time it's applied, you could use a macro: Option Explicit Sub auto_Open() With ThisWorkbook.Worksheets("Sheet1").Range("a1") If IsEmpty(.Value) Then .Value = Date End If End With End Sub This looks to see if A1 on Sheet1 is empty. If it is, it plops in today's date.
B Bob Pearce - Australia Sep 27, 2008 #3 Thanks Dave! Dave Peterson said: You could use a formula that changes to the current date -- no matter when it opens: =today() If you want date that doesn't change after the first time it's applied, you could use a macro: Option Explicit Sub auto_Open() With ThisWorkbook.Worksheets("Sheet1").Range("a1") If IsEmpty(.Value) Then .Value = Date End If End With End Sub This looks to see if A1 on Sheet1 is empty. If it is, it plops in today's date. Click to expand...
Thanks Dave! Dave Peterson said: You could use a formula that changes to the current date -- no matter when it opens: =today() If you want date that doesn't change after the first time it's applied, you could use a macro: Option Explicit Sub auto_Open() With ThisWorkbook.Worksheets("Sheet1").Range("a1") If IsEmpty(.Value) Then .Value = Date End If End With End Sub This looks to see if A1 on Sheet1 is empty. If it is, it plops in today's date. Click to expand...