ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how can i record how long a workbook is open? (https://www.excelbanter.com/excel-programming/381773-re-how-can-i-record-how-long-workbook-open.html)

Corey

how can i record how long a workbook is open?
 
Try this :

Private Sub Workbook_Open()
' This will log the Time Opened
With Sheet1
..Range("A1").Value = Now()
End With
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
' This will Log the Time Closed and the Time WorkBook was opened in A3.
With Sheet1
..Range("A2").Value = Now()
..Range("A3").Value = .Range("A2").Value - Range("A1").Value
End With
MsgBox "This workBook was just Opened for " & Range("A3").Text
End Sub


Format A1-A3 as hhmmss


Corey....


If you set say A3 to Compare the difference in time difference in time would
be how long the workbook was last used for

"AJB" wrote in message
...
I am trying to roughly track time spent on our estimating process. Thanks!





All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com