Alias for =today()
Luke
Can be done a couple of different ways.
Do you want the updating function of TODAY() or just have a static date entered?
1. Select range or column and InsertNameDefine.
Name "T"(no quotes)
Refers to =TODAY()
enter =t to get an updating date in the cell.
For a static date just hit CTRL + ;
2. With code you could either a static date or the formula =TODAY()
Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1:A100")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If .Value = "T" Then
' .Value = Date 'static date only
.Value = "=TODAY()"
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub
Gord Dibben MS Excel MVP
On Thu, 11 Jan 2007 12:00:03 -0800, Luke Slotwinski
wrote:
I have a column formated for simple date. I'd like to be able to enter "T"
in the cell and have it automatically insert the current date, when leaving
the cell. Essentially replacing "T" with =today(). What would be the most
efficient way of going about this.
Thank you,
Luke Slotwinski
|