Hello. I checked out this forum post:
Function for last modified date of cell.
I was able to set up a test Excel 2013 spreadsheet ("test.xlsm") with values in column B, cells 2 through 6 and in cells I wanted to have last modified dates in column E, rows 2 through 6. From the spreadsheet I opened the VB window, and double-clicked on Sheet1 to open a new Worksheet Change window. In this window I entered:
In E2 I entered
and copied this down to E6 (so the B2 would propagate to B6).
Saved everything, then closed and reopened the Excel file.
It worked. Great! If I change a value in B3, it gives me a new date in E3. Exactly what I needed for my primary worksheet.
However, in my primary worksheet (call it "work.xlsm") I needed to have dates that showed when any values changed in range D12:D55. I wanted the new dates to show up in range I12:I55. I entered the spreadsheet and followed the same procedure for Sheet1 (no other SheetChange VB scripts in this workbook) but thefollowing VB didn't work:
which includes entering
into cells E12 and copying down through E55.
This did NOT work. I'm pretty stumped. Any advice on what might be wrong? The only thing really different about the spreadsheets are that "work.xlsm" has several worksheets, and was originally "work.xlsx" and had to be resaved as "work.xlsm" to enable macros.
Pete
Function for last modified date of cell.
I was able to set up a test Excel 2013 spreadsheet ("test.xlsm") with values in column B, cells 2 through 6 and in cells I wanted to have last modified dates in column E, rows 2 through 6. From the spreadsheet I opened the VB window, and double-clicked on Sheet1 to open a new Worksheet Change window. In this window I entered:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B2:B7")) Is Nothing Then Exit Sub
Target.Offset(0, 3) = Now()
End Sub
In E2 I entered
Code:
=lastmodified(B2)
Saved everything, then closed and reopened the Excel file.
It worked. Great! If I change a value in B3, it gives me a new date in E3. Exactly what I needed for my primary worksheet.
However, in my primary worksheet (call it "work.xlsm") I needed to have dates that showed when any values changed in range D12:D55. I wanted the new dates to show up in range I12:I55. I entered the spreadsheet and followed the same procedure for Sheet1 (no other SheetChange VB scripts in this workbook) but thefollowing VB didn't work:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("D12:D55")) Is Nothing Then Exit Sub
Target.Offset(0, 5) = Now()
End Sub
which includes entering
Code:
=lastmodified(D12)
This did NOT work. I'm pretty stumped. Any advice on what might be wrong? The only thing really different about the spreadsheets are that "work.xlsm" has several worksheets, and was originally "work.xlsx" and had to be resaved as "work.xlsm" to enable macros.
Pete