View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
PYO1012 PYO1012 is offline
external usenet poster
 
Posts: 6
Default Date Stamp in one cell when data in other range changes

I have a question:

I've been using Dave's macro for a while now but there's one thing I wish I
could resolve...
The problem is a Debug error that occurs when I start to type in the cell
that triggers the timestamp but then decide to delete what I was typing and
leave the cell with no information. Is there something that can be added to
the following macro to have it keep the debug error from happening when I
leave the trigger cell blank after clicking in it?

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("E11:E510"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, -2).ClearContents
Else
With .Offset(0, -2)
.NumberFormat = "hh:mm"
.Value = Time
End With
End If
Application.EnableEvents = True
End If
End With
End Sub

Any help would be appreciated!