if user changes cell - timestamp cell in next column

  • Thread starter Thread starter ed
  • Start date Start date
E

ed

I have this so far:
Sub DateStamp()
ActiveCell.FormulaR1C1 = "=TODAY()"
Selection.Copy
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub

but how do I make this automatic if a cell is changed?
 
perfect thanks
-----Original Message-----
right click on the worksheet tab that should behave this way. Select view code
and paste this in:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub

On Error GoTo errHandler:

Application.EnableEvents = False
With Target.Offset(0, 1)
.Value = Date
.NumberFormat = "mm/dd/yyyy"
End With

errHandler:
Application.EnableEvents = True

End Sub

But you may want to be more specific. Maybe a certain column.

if intersect(target, range("e:e, g:g")) is nothing then exit sub

would just look for changes in column E or G. (and that line could go right
after the target.cells.count line.)


--

Dave Peterson
(e-mail address removed)
.
 
Back
Top