Cumulative Time Usage in a Worksheet
Does anyone know how to build a time clock into a worksheet that will track
the cumulative time the worksheet is used for each opening and closing of the worksheet? -- Charles1732 |
Create a Public variable called nTime in a standard code module, and add
this code to your workbook Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) With Worksheets("Sheet1").Range("a1") .Value = .Value + (Now - nTime) End With End Sub Private Sub Workbook_Open() nTime = Now End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips "Charles1732" wrote in message ... Does anyone know how to build a time clock into a worksheet that will track the cumulative time the worksheet is used for each opening and closing of the worksheet? -- Charles1732 |
All times are GMT +1. The time now is 09:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com