Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Logging time in Excel

I have a large model that is a template for negotiation events. A lot of
people use this template. I would like to build in a macro that tracks the
amount of time each user spends in the workbook. I'm thinking they would
click a button that would start the timer and the timer would run as long as
they had the workbook open. The timer would stop when they close the
workbook, but restart whenever the workbook is opened again. We need this
information for reporting on the amount of time spent working in negotiations.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Logging time in Excel

Create a worksheet and name it Log, then hide that worksheet

Option Explicit

Private nTime As Double

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim iFreeRow As Long
With Worksheets("Log")
iFreeRow = .Cells(.Rows.Count, "A").End(xlUp).Row
If iFreeRow 1 Or .Range("A1").Value < "" Then
.Range("A1").Value = "User"
.Range("B1").Value = "Logged In"
.Range("C1").Value = "Logged Out"
.Range("D1").Value = "Elapsed"
End If
iFreeRow = iFreeRow + 1
.Cells(iFreeRow, "A").Value = Environ("UserName")
With .Cells(iFreeRow, "B")
.Value = nTime
.NumberFormat = "dd mmm yyyy hh:mm:ss"
End With
With .Cells(iFreeRow, "C")
.Value = Now
.NumberFormat = "dd mmm yyyy hh:mm:ss"
End With
With .Cells(iFreeRow, "D")
.Value = Now - nTime
.NumberFormat = "hh:mm:ss"
End With
End With
thosworkbook.Save

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

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Chad81" wrote in message
...
I have a large model that is a template for negotiation events. A lot of
people use this template. I would like to build in a macro that tracks
the
amount of time each user spends in the workbook. I'm thinking they would
click a button that would start the timer and the timer would run as long
as
they had the workbook open. The timer would stop when they close the
workbook, but restart whenever the workbook is opened again. We need this
information for reporting on the amount of time spent working in
negotiations.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Logging time in Excel

It would be a little more fool-proof if the user did not have to puch a
button. Just have the macro record
=NOW()
whenever the workbook is opened or closed.
--
Gary''s Student
gsnu200708


"Chad81" wrote:

I have a large model that is a template for negotiation events. A lot of
people use this template. I would like to build in a macro that tracks the
amount of time each user spends in the workbook. I'm thinking they would
click a button that would start the timer and the timer would run as long as
they had the workbook open. The timer would stop when they close the
workbook, but restart whenever the workbook is opened again. We need this
information for reporting on the amount of time spent working in negotiations.

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
logging out Tom Excel Programming 0 August 2nd 06 10:45 PM
Logging username, date and time Maddoktor Excel Programming 8 July 8th 06 12:27 PM
Where might I find an Excel template for logging DVD movies Bigedtech Excel Discussion (Misc queries) 1 March 12th 06 06:01 AM
DDE Logging Data Loss in Excel PSY_UK Excel Discussion (Misc queries) 0 December 1st 05 09:01 AM
logging excel events? John Wilson Excel Programming 0 July 13th 03 02:26 AM


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

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

About Us

"It's about Microsoft Excel"