Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
AJB AJB is offline
external usenet poster
 
Posts: 40
Default add a timer to my template

I am a cost estimator who works on 2-12 bids a week and I want to add a timer
to my template that simply counts up from zero while the workbook is open
(and cumulatively each time opened) so I can compare my time usage vs. job
profit estimated.

I am a programming rookie, thanks for your assistance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default add a timer to my template

One way:

Put this the ThisWorkbook Code module:


Private Sub Workbook_Open()
StartCounting bStart:=True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopCounting
End Sub

Put this in a regular code module:

Public dNextCall As Double

Public Sub StartCounting(Optional bStart As Boolean = False)
Const dINCREMENT As Date = #00:01:00#
If Not bStart Then
With Sheets("Sheet1").Range("A1")
.Value = .Value + dINCREMENT
End With
End If
dNextCall = Now + dINCREMENT
Application.OnTime dNextCall, "StartCounting", Schedule:=True
End Sub

Public Sub StopCounting()
Application.OnTime dNextCall, "StartCounting", Schedule:=False
End Sub

Change the Sheet and range, and the increment, to suit.

In article ,
AJB wrote:

I am a cost estimator who works on 2-12 bids a week and I want to add a timer
to my template that simply counts up from zero while the workbook is open
(and cumulatively each time opened) so I can compare my time usage vs. job
profit estimated.

I am a programming rookie, thanks for your assistance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
AJB AJB is offline
external usenet poster
 
Posts: 40
Default add a timer to my template

that works perfectly, thank you.


"JE McGimpsey" wrote:

One way:

Put this the ThisWorkbook Code module:


Private Sub Workbook_Open()
StartCounting bStart:=True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopCounting
End Sub

Put this in a regular code module:

Public dNextCall As Double

Public Sub StartCounting(Optional bStart As Boolean = False)
Const dINCREMENT As Date = #00:01:00#
If Not bStart Then
With Sheets("Sheet1").Range("A1")
.Value = .Value + dINCREMENT
End With
End If
dNextCall = Now + dINCREMENT
Application.OnTime dNextCall, "StartCounting", Schedule:=True
End Sub

Public Sub StopCounting()
Application.OnTime dNextCall, "StartCounting", Schedule:=False
End Sub

Change the Sheet and range, and the increment, to suit.

In article ,
AJB wrote:

I am a cost estimator who works on 2-12 bids a week and I want to add a timer
to my template that simply counts up from zero while the workbook is open
(and cumulatively each time opened) so I can compare my time usage vs. job
profit estimated.

I am a programming rookie, thanks for your assistance.


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
Is there a day timer template in word or excel? Lisa Excel Discussion (Misc queries) 1 January 9th 13 09:03 PM
template timer stopwatch wamay Excel Worksheet Functions 1 April 15th 06 10:24 PM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
Msg Box Timer Steph[_3_] Excel Programming 13 March 18th 05 06:40 PM
Timer Phil Excel Programming 4 February 6th 04 01:58 PM


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