Worksheet : Show last time updated

JCG82

Board Regular
Joined
May 21, 2008
Messages
101
I have this code to show the last time my work book was updated :

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheet1.Range("I56").Value = DateTime.Now
End Sub

I would like to use this same idea to apply the function to each work sheet in the work book. Can someone help me with the code and I assume I will put "that" code into each work sheet in the VBA editor ?
 

Some videos you may like

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)

JCG82

Board Regular
Joined
May 21, 2008
Messages
101
Private Sub Workbook_SheetChange(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheet1.Range("I56").Value = DateTime.Now
End Sub

I tried to place this in the work sheet code section, however it doesn't populate 156, if I alter the sheet or save the sheet.

Am I off track on this?
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Try this:

<font face=Calibri><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_SheetChange(<SPAN style="color:#00007F">ByVal</SPAN> Sh <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Object</SPAN>, <SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)<br>    ActiveSheet.Range("I56").Value = <SPAN style="color:#00007F">Date</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Note that the arguments are different.

HTH,
 

JCG82

Board Regular
Joined
May 21, 2008
Messages
101
Perfect thank you.. one day I will learn..

Happy Thanksgiving
 

Watch MrExcel Video

Forum statistics

Threads
1,122,413
Messages
5,595,998
Members
414,037
Latest member
Roamingsmile

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
Top