Fixing date of entry
In article , Gord Dibben
writes
I would abandon the use of a formula which uses the function TODAY().
TODAY() is a volatile function so will not remain static.
To get a static date entered you can use VBA sheet event code.
Right-click on the INPUT sheet tab and "View Code"
Copy/paste the following code into that module.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 2 Then
n = Target.Row
If Me.Range("B" & n).Value < "" Then
Me.Range("A" & n).Value = Date
End If
End If
enditall:
Application.EnableEvents = True
End Sub
Hi
OK thanks very much for that.
I have more than one sheet in the workbook , and assume I need to enter
the code under each tab. When I enter text into a cell in B1 , the date
appears in the cell A1 , which is perfect.
Out of interest , can the code be modified so that if subsequently the
text entered into B1 is now deleted , that the date in A1 would be
removed too?
Thanks again.
|