ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I get dates automaticaly inserted when editing excell (https://www.excelbanter.com/excel-programming/366556-how-do-i-get-dates-automaticaly-inserted-when-editing-excell.html)

Alan Johnson[_2_]

How do I get dates automaticaly inserted when editing excell
 
I have a spread sheet sent to me monthly and the people sending it will not
tell us when and what line they have updated. There are currently 15000+
lines and we will have upwards of 70 thousand lines when done with this
project. I want to know how they can add a column and then everytime they
update a line it would automatically add the date.

Alan

Bernie Deitrick

How do I get dates automaticaly inserted when editing excell
 
Alan,

You need to use a worksheet change event to do that: for example, for
any cell in columns A:Z, the date when the entry is made or changed is stored in column AA
using this code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
If Intersect(Target, Range("A:Z")) Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each myCell In Intersect(Target, Range("A:Z"))
Cells(myCell.Row, 27).Value = Now
Cells(myCell.Row, 27).NumberFormat = "mm/dd/yy hh:mm:ss"
Next myCell
Application.EnableEvents = True
End Sub

Copy this code, right-click on the worksheet tab, select "View Code" and
paste the code in the window that appears.

Additionally, you could shade the actual cell that changed by adding this within the For Next loop:

myCell.Interior.ColorIndex = 3

HTH,
Bernie
MS Excel MVP


"Alan Johnson" wrote in message
...
I have a spread sheet sent to me monthly and the people sending it will not
tell us when and what line they have updated. There are currently 15000+
lines and we will have upwards of 70 thousand lines when done with this
project. I want to know how they can add a column and then everytime they
update a line it would automatically add the date.

Alan





All times are GMT +1. The time now is 05:25 PM.

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