ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Now Date Formula (https://www.excelbanter.com/excel-programming/302536-now-date-formula.html)

Jodi[_3_]

Now Date Formula
 
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.

Bob Phillips[_6_]

Now Date Formula
 
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)

"Jodi" wrote in message
...
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.





All times are GMT +1. The time now is 07:07 AM.

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