View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Time/Date Stamp Multiple Rows

Maybe something like:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myRow As Long

If Target.Cells.Count 1 Then
Exit Sub 'one cell at a time
End If

If Application.Intersect(Target, Me.Range("B16:F74")) Is Nothing Then
'do nothing
Else
myRow = Target.Row
With Me.Cells(myRow, "G")
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
Application.EnableEvents = False
.Value = Now
Application.EnableEvents = True
End With
End If
End Sub


DataGuy wrote:

I am using the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("B16:F74")) Is Nothing Then
Range("G16:G74") = Now
Application.EnableEvents = True
End If
End Sub

I get the same time and date in all the rows. How can I fix my code so that
it is row specific.


--

Dave Peterson