ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date in worksheet on opening ... (https://www.excelbanter.com/excel-programming/288750-date-worksheet-opening.html)

Michelle

Date in worksheet on opening ...
 
Hi all,

I have created an excel worksheet template and I want to
be able to have the date inserted into a cell on opening
a new worksheet.

I don't want to simply use the TODAY() function as I
don't want the date to change ...

Is it possible to write a function or macro that would
auto insert the date?

Thanks in advance ...

Michelle

Bob Phillips[_6_]

Date in worksheet on opening ...
 
Michelle,

Private Sub Workbook_Open()
Worksheets("Sheet1").Range("A1").Value = Date
End Sub

Copy this code into the ThisWorkbook code module

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

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

I have created an excel worksheet template and I want to
be able to have the date inserted into a cell on opening
a new worksheet.

I don't want to simply use the TODAY() function as I
don't want the date to change ...

Is it possible to write a function or macro that would
auto insert the date?

Thanks in advance ...

Michelle




chandlm[_5_]

Date in worksheet on opening ...
 
Michelle wrote:
*Hi all,

I have created an excel worksheet template and I want to
be able to have the date inserted into a cell on opening
a new worksheet.

I don't want to simply use the TODAY() function as I
don't want the date to change ...

Is it possible to write a function or macro that would
auto insert the date?

Thanks in advance ...

Michelle *


Hi Michelle

just add these 3 lines to the workbook open event.

dim mydate as date
mydate = Date
Range("a1").Value = mydate ' Remember to change this to the cell you
want to change.



HTH


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 02:47 PM.

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