ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date but not TODAY() ... (https://www.excelbanter.com/excel-programming/288875-date-but-not-today.html)

Michelle

Date but not TODAY() ...
 
Hi all,

I need a little macro for a worksheet template that
enters the date into a cell the first time the worksheet
is created/opened from the template but then preserves
the original date thereafter ... in other words I cannot
use the TODAY() function as it changes the date as the
date progresses.

Thanks in advance ...

Michelle

Rob van Gelder[_4_]

Date but not TODAY() ...
 
Michelle,

Checking to see if the first cell has a date value, if not then set it to
today

Private Sub Workbook_Open()
If Not IsDate(Sheet1.Cells(1).Value) Then Sheet1.Cells(1).Value = Date
End Sub

Rob


"Michelle" wrote in message
...
Hi all,

I need a little macro for a worksheet template that
enters the date into a cell the first time the worksheet
is created/opened from the template but then preserves
the original date thereafter ... in other words I cannot
use the TODAY() function as it changes the date as the
date progresses.

Thanks in advance ...

Michelle





All times are GMT +1. The time now is 11:52 AM.

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