Function for last modified date of cell (again)

hoytpr

New Member
Joined
Oct 6, 2014
Messages
2
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:
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)
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:
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)
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
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I figured it out. The reason is embarrassing, but I had simply shifted my sheets around, so Sheet1 wasn't the sheet I was trying to change.
Thanks for all these great resources.

Pete
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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