Trigger a Date & Time stamp by entering data in another field...
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
N = Target.Row
If Me.Range("A" & N).Value < "" Then
Me.Range("G" & N).Value = Now
End If
End If
enditall:
Application.EnableEvents = True
End Sub
This is sheet event code. Right-click on the sheet tab and "View Code"
Copy/paste the code into that module.
Alt + q to return to the Excel window.
Gord Dibben MS Excel MVP
On Sat, 11 Apr 2009 10:10:02 -0700, mjjohnso
wrote:
Hello All,
I am currently building a spreadsheet with 6 simple column headings:
Employee
Inventory Number
Quantity
Production Unit
Date & Time
Comments
Problem: I would like to set up the “Date & Time” column to where when any
data is entered into a field under the first column (Employee), the
corresponding field under the Date & Time column auto populates the current
date and time. (Obviously to minimize data entry for the employees)
One additional problem: Once that Date & Time field auto populates with the
current time it needs to remain with that time and not update.
Thank-you for any help.
|