ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Inserting Automatic Date (https://www.excelbanter.com/excel-worksheet-functions/46122-inserting-automatic-date.html)

Johnathon Aaron Steel

Inserting Automatic Date
 
I have a Template and when I open it up I want it to be able to insert
the date in a specific cell on open and not have to type it in.

Is this possible?

Thanx

JAS

Paul B

Johnathon, put this in the cell

=TODAY()
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Johnathon Aaron Steel" wrote in message
...
I have a Template and when I open it up I want it to be able to insert
the date in a specific cell on open and not have to type it in.

Is this possible?

Thanx

JAS




David McRitchie

Hi Johnathon,

Current Date:
If you are just using the file during day and not over midnight
you can use =TODAY() which will change after midnight and
a recalculation takes place.

Date First Opened
Do you want a constant set permanently when the workbook is
originally opened using an Event macro. If the sheet is deleted
a new one will be created next time workbook is opened.

In your Template, right click on the logo to left of the menu bar,
View code, insert the following code after your Option Explicit
which you should already have.

Sub WorkBook_Open()
On Error Resume Next
If Len(Worksheets("newdoc").Name) = 0 Then
On Error GoTo 0
Sheets.Add After:=Sheets(Sheets.Count) '-- place at end
ActiveSheet.Name = "newdoc"
Range("A1") = Now() '-- or for just date use DATE
Columns("A:A").EntireColumn.AutoFit
Sheets(1).Activate
Else
On Error GoTo 0
End If
End Sub

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Johnathon Aaron Steel" wrote in message ...
I have a Template and when I open it up I want it to be able to insert
the date in a specific cell on open and not have to type it in.

Is this possible?

Thanx

JAS




Bob Phillips

Private Sub Workbook_Open()
Worksheets("Sheet1").Range("A1").Value = Format(Date, "dd mmm yyyy")
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

"Johnathon Aaron Steel" wrote in message
...
I have a Template and when I open it up I want it to be able to insert
the date in a specific cell on open and not have to type it in.

Is this possible?

Thanx

JAS





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

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