Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default accumulate time file is open

i am working on files in excel where i need to keep track of how long the
files have been open, so that I can complete a timesheet for billing
purposes. Is there anyway to track this information within the excel file(s)
itself?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default accumulate time file is open

Insert a new worksheet in your workbook.

In A1 enter Date
In B1 enter Time Opened
In C1 enter Time Closed
In D1 enter Working Time

In D2 enter =IF(C2="","",C2-B2)

In Thisworkbook module paste this code.

Private Sub Workbook_Open()
Dim rng As Range
Set rng = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
With rng
.Value = Format(Date, "mm/dd/yyyy")
.Offset(0, 1).Value = Format(Time, "hh:mm:ss")
End With
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim rng As Range
Set rng1 = Sheets("Sheet1").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0)
If rng1.Offset(0, -1).Value = "" Then Exit Sub
rng1.Value = Format(Time, "hh:mm:ss")
ThisWorkbook.Save
End Sub


Gord Dibben MS Excel MVP


On Tue, 14 Jul 2009 07:13:01 -0700, RAMJET
wrote:

i am working on files in excel where i need to keep track of how long the
files have been open, so that I can complete a timesheet for billing
purposes. Is there anyway to track this information within the excel file(s)
itself?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
When i open excel file it takes time to open Muraliraj Menon Excel Discussion (Misc queries) 1 May 23rd 07 12:50 PM
How can I accumulate time in a flight log? RossR Excel Discussion (Misc queries) 1 January 1st 06 05:50 AM
Can Excel open a new application every time you open a file? shoon Setting up and Configuration of Excel 0 December 13th 05 03:28 PM
Accumulate weekly time to total time in Excel. delve Excel Discussion (Misc queries) 0 May 4th 05 08:14 PM
How do I stop Excel from closing the open file each time I open a. Welsin Setting up and Configuration of Excel 3 January 8th 05 11:16 PM


All times are GMT +1. The time now is 11:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"