This uses column 3 (C) as the date column. Right click on the sheet tab and
select view code. Paste in code like this:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler:
If Target.Count > 1 Then Exit Sub
If Target.Column <> 3 Then
Application.EnableEvents = False
Cells(Target.Row, 3).Value = Now
Cells(Target.Row, 3).NumberFormat = "mm/dd/yy hh:mm"
Columns(3).AutoFit
End If
ErrHandler:
Application.EnableEvents = True
End Sub
Great thanks i have edited the code to suit as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler:
If Target.Count > 1 Then Exit Sub
If Target.Column <> 11 Then
Application.EnableEvents = False
Cells(Target.Row, 11).Value = Now
Cells(Target.Row, 11).NumberFormat = "mm/dd/yy hh:mm"
Columns(11).AutoFit
End If
ErrHandler:
Application.EnableEvents = True
End Sub
What would i have to change so the code would only apply to cells K2
K30 ? Thank
Great thanks i have edited the code to suit as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler:
If Target.Count > 1 Then Exit Sub
If Target.Column <> 11 Then
Application.EnableEvents = False
Cells(Target.Row, 11).Value = Now
Cells(Target.Row, 11).NumberFormat = "mm/dd/yy hh:mm"
Columns(11).AutoFit
End If
ErrHandler:
Application.EnableEvents = True
End Sub
What would i have to change so the code would only apply to cells K2
K30 ? Thank
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrHandler:
If Target.Count > 1 Then Exit Sub
If Not Intersect(Range("K2:K30"),Target) is nothing Then
Application.EnableEvents = False
Cells(Target.Row, 11).Value = Now
Cells(Target.Row, 11).NumberFormat = "mm/dd/yy hh:mm"
Columns(11).AutoFit
End If
ErrHandler:
Application.EnableEvents = True
End Sub