Automatically insert date

  • Thread starter Thread starter sheryar khan
  • Start date Start date
S

sheryar khan

Hi!
I have column "A" for date. I want to do that if I enter data in
column "B" column, Column "A" automaticcaly insert today date. I have
the following function but when I open my worksheet next time it
automatically change that date to current date.

=IF(B6="","",TODAY())

Is this possible.
 
Right-click on the sheet tab and "View Code"

Copy/paste this event code into that sheet module.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B:B")) Is Nothing Then
With Target
If .Value <> "" Then
.Offset(0, -1).Value = Format(Now, "dd mmm yyyy hh:mm:ss")
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

When data is entered in column B a static date/time will be entered in
column A


Gord Dibben MS Excel MVP
 
Back
Top