Consulting

Results 1 to 4 of 4

Thread: datestamp on cell CHANGE

  1. #1
    VBAX Newbie
    Joined
    Oct 2012
    Posts
    3
    Location

    datestamp on cell CHANGE

    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

  2. #2
    VBAX Regular
    Joined
    Aug 2011
    Posts
    87
    Location
    Hi. Try this instead.

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

  3. #3
    VBAX Newbie
    Joined
    Oct 2012
    Posts
    3
    Location
    Quote Originally Posted by omp001
    Hi. Try this instead.

    [VBA]Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column <> 5 Then Exit Sub
    Cells(Target.Row, 14).Value = Date
    End Sub[/VBA]
    Ok Thanks that seems to work differently but I don't see why???

  4. #4
    VBAX Regular
    Joined
    Aug 2011
    Posts
    87
    Location
    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)
    Regards
    Osvaldo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •