Forum Discussion
paulc1545
Dec 05, 2022Copper Contributor
Date of Last Modified for a Cell
Good day, all. I am inquiring if there is an excel function that would give me a date (and time) that an individual cell was last modified. For example: cell A2 has an entry of $2.55 and I'd lik...
washcaps2
Sep 29, 2023Copper Contributor
My date is working but the time is coming up at 12:00 AM
Also, how can I set it up to update the date and time of last edit if something in columns G through J were edited? Or in columns C, E, F, J, K?
Also, how can I set it up to update the date and time of last edit if something in columns G through J were edited? Or in columns C, E, F, J, K?
washcaps2
Sep 29, 2023Copper Contributor
figured out the time part
- washcaps2Oct 06, 2023Copper ContributorYeah I think the problem was when I inserted a column. It then put the last edit time in all rows to the end. Should be good now. Thanks again!
- HansVogelaarOct 06, 2023MVP
Did you perhaps do something that caused the code to enter the date and time in ALL rows of column K? If so, do the following:
- Activate the Visual Basic Editor.
- Press Ctrl+G to activate the Immediate window.
- Type (or copy/paste) the line Application.EnableEvents = False
- With the insertion point in that line, press Enter.
- Switch back to Excel.
- Select all rows from the row below the "real" used range of the sheet to the very last row 1048576.
- Right-click in the selection and select Delete.
- Activate the Visual Basic Editor.
- Press Ctrl+G to activate the Immediate window.
- Type (or copy/paste) the line Application.EnableEvents = True
- With the insertion point in that line, press Enter.
- Switch back to Excel.
- Save the workbook.
- washcaps2Oct 06, 2023Copper Contributor
- washcaps2Oct 06, 2023Copper Contributor
HansVogelaar Did this screenshot work? It's the error message I get
- HansVogelaarOct 06, 2023MVP
That must have another cause. The code doesn't impose a limit.
- washcaps2Oct 06, 2023Copper Contributor
Thanks, that worked. Only problem I'm having is that I can't insert rows as it says the limit is exceeded. I'll only ever need 200 rows or so. Can I limit it to 200 rows instead of the million?
- HansVogelaarSep 29, 2023MVP
Let's say you want the timestamp in column M.
Use this variation of the code posted higher up:
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Range("C2:C" & Rows.Count & ",E2:F" & Rows.Count & _ ",J2:K" & Rows.Count), Target) Is Nothing Then Application.ScreenUpdating = False Application.EnableEvents = False Intersect(Range("M:M"), Intersect(Range("C2:C" & Rows.Count & _ ",E2:F" & Rows.Count & ",J2:K" & Rows.Count), Target).EntireRow).Value = Now Application.EnableEvents = True Application.ScreenUpdating = True End If End Sub