Last modified date for a range of cells

DJPowelly

New Member
Joined
Dec 15, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Hi, I need a bit of help please.

I have a table that tracks learner progress. I would like to be able to show in a cell the last date any cell in a range was modified.
I have set this up as a table to allow others to add learners and not have to copy and past all of the formulas each time, so each time a new row is added the date has to relate to the cells in that row.

I would like to look at cells P4 to X4 and have the latest date that any of those cells were modified in Y4. When a new learner is added i would need Y5 to record the date from P5 to X5 and so on as new rows are added.

1646389127007.png


An alternative might be to take the date from O4 as this is calculated from cells P4 to X4 and should update whenever on of those cells changes.

I have looked at other VBA codes and they apply to the whole sheet or workbook and I would like to look at specific cells.

Any help would be greatly appreciated.

Many thanks

Keith
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Have been using this snippet for cells with formulas. Have a try and see if you can use it with your project. The macro has to be pasted in the sheet's module.
Since I find that it would be easier to check for changes of formulas in column O it already is coded for this. I presume that your are manually filling cells somewhere in columns A to N.
Otherwise attach (host link) a file with the exact structure of your sheet (just a few rows and no personal data).
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim vOld      As Variant
    If Not Range("O" & Target.Row) Is Nothing Then
        On Error GoTo Xit
        Application.EnableEvents = False
        Application.Undo
        vOld = Range("O" & Target.Row).Value
        Application.Undo
        If vOld <> Range("O" & Target.Row) Then Range("Y" & Target.Row) = Format(Now, "dd/mm/yyyy - hh:mm:ss")
    End If
Xit:
    Application.EnableEvents = True
End Sub
 
Upvote 0
Have been using this snippet for cells with formulas. Have a try and see if you can use it with your project. The macro has to be pasted in the sheet's module.
Since I find that it would be easier to check for changes of formulas in column O it already is coded for this. I presume that your are manually filling cells somewhere in columns A to N.
Otherwise attach (host link) a file with the exact structure of your sheet (just a few rows and no personal data).
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim vOld      As Variant
    If Not Range("O" & Target.Row) Is Nothing Then
        On Error GoTo Xit
        Application.EnableEvents = False
        Application.Undo
        vOld = Range("O" & Target.Row).Value
        Application.Undo
        If vOld <> Range("O" & Target.Row) Then Range("Y" & Target.Row) = Format(Now, "dd/mm/yyyy - hh:mm:ss")
    End If
Xit:
    Application.EnableEvents = True
End Sub
Hi, Thank you for the code, I have pasted it into the VBA editor for the sheet in question using the view code on the sheet tab at the bottom of the workbook, but I cannot get it to run.
If I click the run button, it does not show up in the list of macros.
sorry about this but i am new to using VBA coding.
 
Upvote 0
Oh, it's not to be run; I used event Worksheet_Change that will automatically trigger whenever a manual change is done somewhere in the sheet (presumably in column A to N where you will be inputting updated data). Then it will test for changes in column O and if any will time-stamp in column Y same row as column O.
 
Upvote 0
Thank you for the update.
The code works if I manually enter a value in column O, but if I update my workbook, it has no effect.
Column O is a sum total of columns P to X, which use a lookup from another worksheet to get the percentage for each column.
I have included the table below.
Thank you for your help with this, it is much appreciated.

Candidate Tracker V2 - table version with macro.xlsm
OPQRSTUVWXY
3Overall progressQELTP3/001QELTP3/002QELTP3/003QELTP3/004QELTP3/005QELTP3/006QELTP3/007AM2Knowledge UnitsLast modified
416%50%17%36%16%15%0%0%0%0%
538%68%12%32%50%67%44%0%0%0%
Progress_Overview
Cell Formulas
RangeFormula
O4:O5O4=(P4*0.0876)+(Q4*0.0837)+(R4*0.1315)+(S4*0.2072)+(T4*0.1195)+(U4*0.1912)+(V4*0.1594)+(W4*0.002)+(X4*0.0179)
P4:P5P4=XLOOKUP([@Name],'1605'!B:B,'1605'!CF:CF)
Q4:Q5Q4=XLOOKUP([@Name],'1605'!B:B,'1605'!EN:EN)
R4:R5R4=XLOOKUP([@Name],'1605'!B:B,'1605'!JB:JB)
S4:S5S4=XLOOKUP([@Name],'1605'!B:B,'1605'!PV:PV)
T4:T5T4=XLOOKUP([@Name],'1605'!B:B,'1605'!TH:TH)
U4:U5U4=XLOOKUP([@Name],'1605'!B:B,'1605'!YV:YV)
V4:V5V4=XLOOKUP([@Name],'1605'!B:B,'1605'!ADX:ADX)
W4:W5W4=XLOOKUP([@Name],'1605'!B:B,'1605'!ADZ:ADZ)
X4:X5X4=XLOOKUP([@Name],'1605'!B:B,'1605'!AEJ:AEJ)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
O:YCell Value=1textNO
 
Upvote 0
Sorry, no idea how to detect this sort of formula update (=XLOOKUP). As said in post #2, I was presuming (and hoping) that the changes in ranges O and P:X were coming from manual changes somewhere in columns A:N since you were not showing them. Tried with event Worksheet_Calculate but can't get it to work properly.
 
Upvote 0
Sorry, no idea how to detect this sort of formula update (=XLOOKUP). As said in post #2, I was presuming (and hoping) that the changes in ranges O and P:X were coming from manual changes somewhere in columns A:N since you were not showing them. Tried with event Worksheet_Calculate but can't get it to work properly
I have had an idea where I may be able to use this elsewhere in the workbook that does have manual inputs. but I would need to change column O to a range of columns.
Is that possible? if so how would I enter it as code?
 
Upvote 0
Will work as long as the manual input is on the same row where the time-stamp (column Y) will to be updated. If I guessed correctly, you are randomly inputting data in a Table (maybe even in another sheet); what I can't get is the exact row reference which comes with the result of (=XLOOKUP).
 
Upvote 0
Will work as long as the manual input is on the same row where the time-stamp (column Y) will to be updated. If I guessed correctly, you are randomly inputting data in a Table (maybe even in another sheet); what I can't get is the exact row reference which comes with the result of (=XLOOKUP).
On a separate table I manually input the learners work in multiple columns. I could add the code to that table as it is a manual entry.
From there I could use a lookup to add it to the overview table above.
The only thing is the manual entry could be in any cell in a range on the same row.
As the code you provided refers to column O I cannot get it to pickup changes in any other column.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top