Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Keeping a running time total

I would like to use Excel for a television program director's rundown
sheet. Is there a simple formula that would show running time by
segment from the start of the program to the end? In other words, the
program would start at 00:00:00 and end at 30:00:00. I would like one
column to keep a running time total for each element of the program.
Thanks for your help!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Keeping a running time total


Perhaps something like this:

Module code:

Code:
--------------------

Option Explicit


Public Declare Function SetTimer Lib "user32" ( _
ByVal HWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long

Public Declare Function KillTimer Lib "user32" ( _
ByVal HWnd As Long, _
ByVal nIDEvent As Long) As Long

Public Declare Function GetTickCount Lib "kernel32" () As Long


Public TimerID As Long
Public TimeStarted As Long

Sub StartTimer()
TimerID = SetTimer(0&, 0&, 1, AddressOf TimerProc)
End Sub

Sub EndTimer()
On Error Resume Next
KillTimer 0&, TimerID
End Sub

Sub TimerProc(ByVal HWnd As Long, ByVal uMsg As Long, ByVal nIDEvent As Long, ByVal dwTimer As Long)
Sheet1.Cells(1, 1).Value = CInt((GetTickCount - TimeStarted) / 10)
End Sub

--------------------


Worksheet code:

Code:
--------------------

Option Explicit


Private Sub CommandButton1_Click()
TimeStarted = GetTickCount
Call StartTimer
End Sub

Private Sub CommandButton2_Click()
Call EndTimer
Sheet1.Cells(1, 1).Value = ""
End Sub

--------------------

You will have to format the output to mm:ss:ds


--
mms
------------------------------------------------------------------------
mms's Profile: http://www.excelforum.com/member.php...o&userid=16536
View this thread: http://www.excelforum.com/showthread...hreadid=535914

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Keeping a running time total

Using Windows Timers in VBA is dangerous. Any number of actions
can cause Excel to crash. Under some circumstances even selecting
another cell will cause a crash.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"mms" wrote in
message ...

Perhaps something like this:

Module code:

Code:
--------------------

Option Explicit


Public Declare Function SetTimer Lib "user32" ( _
ByVal HWnd As Long, _
ByVal nIDEvent As Long, _
ByVal uElapse As Long, _
ByVal lpTimerFunc As Long) As Long

Public Declare Function KillTimer Lib "user32" ( _
ByVal HWnd As Long, _
ByVal nIDEvent As Long) As Long

Public Declare Function GetTickCount Lib "kernel32" () As Long


Public TimerID As Long
Public TimeStarted As Long

Sub StartTimer()
TimerID = SetTimer(0&, 0&, 1, AddressOf TimerProc)
End Sub

Sub EndTimer()
On Error Resume Next
KillTimer 0&, TimerID
End Sub

Sub TimerProc(ByVal HWnd As Long, ByVal uMsg As Long, ByVal
nIDEvent As Long, ByVal dwTimer As Long)
Sheet1.Cells(1, 1).Value = CInt((GetTickCount - TimeStarted) /
10)
End Sub

--------------------


Worksheet code:

Code:
--------------------

Option Explicit


Private Sub CommandButton1_Click()
TimeStarted = GetTickCount
Call StartTimer
End Sub

Private Sub CommandButton2_Click()
Call EndTimer
Sheet1.Cells(1, 1).Value = ""
End Sub

--------------------

You will have to format the output to mm:ss:ds


--
mms
------------------------------------------------------------------------
mms's Profile:
http://www.excelforum.com/member.php...o&userid=16536
View this thread:
http://www.excelforum.com/showthread...hreadid=535914



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
Total of two time keeping codes in one cell something68 Excel Discussion (Misc queries) 7 September 3rd 09 03:50 PM
keeping a running total in a single cell shrtdawg73 Excel Worksheet Functions 10 August 23rd 06 12:17 AM
keeping a running time for tv program Jim Excel Worksheet Functions 0 April 24th 06 06:16 PM
Keeping formulas on running total and sorts LoriM1 Excel Worksheet Functions 0 April 19th 06 02:58 PM
adding a cell to a cell keeping a running total please help RELWOD85[_5_] Excel Programming 1 August 3rd 05 08:31 AM


All times are GMT +1. The time now is 03:08 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"