ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto insert Date & Time when another cell is populated (https://www.excelbanter.com/excel-discussion-misc-queries/112386-auto-insert-date-time-when-another-cell-populated.html)

Trixie

Auto insert Date & Time when another cell is populated
 
Is there any way I can populate the column AV in my spreadsheet with the Date
and Time once a value has been entered in column AV and keep this original
value. Can I protect this original value from being changed?

I can insert the date and time wiht the Now() function but this updates so
does not serve our purpose.
Thanks heaps

Max

Auto insert Date & Time when another cell is populated
 
Try JE McGimpsey's coverage of "Time and date stamps" at his page:
http://www.mcgimpsey.com/excel/timestamp.html

A sample implemented with JE's first sub (below) is available at:
http://savefile.com/files/41920
Date_Time_Stamping.xls

---------
Steps:
Right-click the sheet tab Choose View code
Clear the defaults, and paste-in JE's code below
(from: http://www.mcgimpsey.com/excel/timestamp.html)
Press Alt+Q to get back to Excel

Test it out. When you input entries into A2:A10, the date/time stamp will be
logged into col B. Clearing entries will clear the corresponding stamps.
Adapt the range to suit: Range("A2:A10").

'-------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:A10"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 1).ClearContents
Else
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub
'------
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Trixie" wrote:
Is there any way I can populate the column AV in my spreadsheet with the Date
and Time once a value has been entered in column AV and keep this original
value. Can I protect this original value from being changed?

I can insert the date and time wiht the Now() function but this updates so
does not serve our purpose.
Thanks heaps



All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com