Date in worksheet on opening ...

  • Thread starter Thread starter Michelle
  • Start date Start date
M

Michelle

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
 
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 said:
*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
 
Back
Top