Thread: Timestamp Macro
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PatK PatK is offline
external usenet poster
 
Posts: 96
Default Timestamp Macro

Hey, all....In another post in these forums, a gent had posted a really slick
macro to insert a timestamp in a row, if any cells in that row changed. I
"leveraged" that code (below). Problem is, it worked PERFECTLY for awhile,
and then completely stopped. I have inserted Debug code right at the top of
the subroutine, and it does not dump anything to the immediate window. I
have no idea why the macro worked so well, then stopped.

I have data in columns A through Z. My timestamp "was" going into column
AA, until it crapped out. Any ideas?

Thanks!,
PatK





Private Sub Worksheet_Change(ByVal Target As Range)

Set t = Target
tr = t.Row
Set r = Range("A:Z")


If Intersect(t, r) Is Nothing Then Exit Sub

Set rr = Range("A" & tr & ":Z" & tr)
n = Application.WorksheetFunction.CountA(rr)
Debug.Print n
Application.EnableEvents = False

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

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