PDA

View Full Version : datestamp on cell CHANGE



ralphg
02-28-2013, 07:14 AM
hi I Have the following code which datestamps even if I just click on the cell
I need it to only datestamp if the value of the cell changes

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 5 Then
Cells(Target.Row, 14).Value = Date
End If

thanks in anticipation

omp001
02-28-2013, 09:01 AM
Hi. Try this instead.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 5 Then Exit Sub
Cells(Target.Row, 14).Value = Date
End Sub

ralphg
02-28-2013, 09:22 AM
Hi. Try this instead.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 5 Then Exit Sub
Cells(Target.Row, 14).Value = Date
End Sub

Ok Thanks that seems to work differently but I don't see why???

omp001
02-28-2013, 10:05 AM
Your original code is triggered as you select a cell in column 'F' (Worksheet_SelectionChange).

The code I suggested is triggered as a cell value is changed in column 'F' (Worksheet_Change)