Now Date Formula

J

Jodi

In cell A5 I have the following formula =IF(B5="","",NOW())
which allows me to enter something into cell B5 and then
the date fills in automatically. What I need is make it
so the date doesn't change in A5, when I go into the
spreadsheet again.
 
B

Bob Phillips

You need VBA for this

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A5")) Is Nothing Then
With Target
If .Offset(0, 10).Value = "" Then
.Value = ""
Else
.Value = Format(Date, "dd mmm yyyy")
End With
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

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