Automatically insert 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.
 
G

Gord Dibben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top