Thread: date/time stamp
View Single Post
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A:A")) Is Nothing Then
With Target
.Offset(0, 1).Value = Time
.Offset(0, 1).NumberFormat = "hh:mm:ss"
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

"Jan" wrote in message
...
I know I probably did post my reply correctly to get a possible solution

to
my problem. Any further help would be greatly appreciated.


Sorry, but I failed to mention the process correctly. If end user enters
data in any cell in column A beginning at cell a2, then I would like the
corresponding cell(same row) in column B to have a date/time stamp that

would
not change when the date/time changes or when the file is saved and

reopened.
Example: if user enters data in cell A2, then B2 would automatically

display
date/time stamp. If user enters data in cell A3, then B3 would have a
date/time stamp...and so on..and so on. TIA.

-----------------------------------------------

Enter this code in the module of the concerned sheet.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
Range("B1") = Now()
End If
End Sub

Will change the date only when you change or enter value in A1
Mangesh

________________________________________

I'm using Excel 2003.

Is this possible?

If end user enters data in A1, can I add a date/time function that will
automatically be entered in cell B1, but not update when the date/time
changes or when the file is closed/opened? Using Today() or Now(), the
date/time in B1 updates when file is closed and then opened.

TIA