Thread: Timestamping
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Timestamping

Try this worksheet event code:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
tr = t.Row
Set r = Range("A:L")
If Intersect(t, r) Is Nothing Then Exit Sub
Set rr = Range("A" & tr & ":L" & tr)
n = Application.WorksheetFunction.CountA(rr)
Application.EnableEvents = False

If n = 0 Then
Cells(tr, "M").Clear
End If
If n = 1 Then
Cells(tr, "M").Value = Now
End If

Cells(tr, "N") = Now
Application.EnableEvents = True
End Sub

--
Gary''s Student - gsnu200771


"ktoth04" wrote:

Hi, I would like to timestamp my document as follows
In one instance, I would like to insert a timestamp in M# whenever it moves
from all the cells in that row being blank to all but one of them being blank
(first instance of a record in this row). I would also like to remove the
timestamp if everything in the row besides M# again becomes blank.

In the 2nd instance, I would like to update N# whenever anything in the row
is updated, with a current timestamp. (ie, last edited date)

Any help?