Thread: Date-time stamp
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Date-time stamp

Daniel,

This assumes the cells where you enter the data are not protected and in
this case it's A1 - A100. Right click your sheet tab, view code and paste the
code below in. Enter data entered in a1 - A100 and you get the timestamp in
the corresponding B1 - B100

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("A1:A100")) Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
ActiveSheet.Unprotect Password:="MyPass"
Target.Offset(, 1) = Now
ActiveSheet.Protect Password:="MyPass"
Application.EnableEvents = True
On Error GoTo 0
End If
End Sub

Mike



"Daniel" wrote:

Hello,

My name is Daniel,
Can you please help me with some code to do the following in Excel:

Have one spreadsheet (with some protection I think); whenever someone
alters the content of some cells, a DateTime stamp should be stored in another
cell (protected).

Thank you