A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Is it possible to enter the date into A2 when the data is entered into C7? Or to have the date enter into A2 when you first enter the document and put data into any field? Rose
You have to make up your mind what you want to happen.
The following will enter the date/time in A2 when anything is first entered in C7. A2 will change next time C7 is changed. If you want A2 to never change again, remove the single quote from this line in the code.
' If Range("A2") <> "" Then GoTo ws_exit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("C7")) Is Nothing Then
If Target.Value <> "" Then
' If Range("A2") <> "" Then GoTo ws_exit Range("A2").Value = Format(Now, "dd mmm yyyy hh:mm:ss")
End If
End If
ws_exit:
Application.EnableEvents = True
End Sub
Gord