auto date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to have a cell i.e F14 - auto date with the days current date
when you open the template?

Andy JL
 
Format the cell to whatever you want to see.

Cells>Format>Number>Date or Custom

Or use =TODAY()


Gord Dibben Excel MVP
 
This is a very useful thread, but what if you only want the current date to
be put in when you click on the cell
 
Use CTRL + ; (semi-colon)

Otherwise you would need to use event code to enter today's date when you
clicked on the cell.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const myRange As String = "A1"
On Error GoTo endit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(myRange)) Is Nothing Then
Target.Value = Format(Date, "mm-dd-yyyy")
End If
endit:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that module. Edit to suit.

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP
 
Back
Top