A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Is there a formula for a timer



 
 
Thread Tools Display Modes
  #1  
Old October 7th, 2009, 06:54 PM posted to microsoft.public.excel.misc
1965cs
external usenet poster
 
Posts: 1
Default Is there a formula for a timer

Is there a formula for a xcell that will count current time, IE display as a
clock or timer?
  #2  
Old October 7th, 2009, 07:20 PM posted to microsoft.public.excel.misc
Mike H
external usenet poster
 
Posts: 8,419
Default Is there a formula for a timer

Hi,

If you mean an updating digital clock then the answers no, you have to make
your own.

Alt+F11 to open VB editor. Right click 'This Workbook' and insert module and
paste the code below in. Run the 'StartClock module and you get your clock in
Sheet 1 - A1. Stop it manually when exiting Excel or better still put the
StopClock sub in the before close event.

Dim Go As Boolean
Sub StartClock()
Go = True
MyClock
End Sub

Sub MyClock()
If Go Then
Worksheets("Sheet1").Cells(1, 1).Value = Format(Now, "hh:mm:ss")
Application.OnTime (Now + TimeSerial(0, 0, 1)), "MyClock"
End If
End Sub

Sub StopClock()
Go = False
End Sub

Mike

"1965cs" wrote:

Is there a formula for a xcell that will count current time, IE display as a
clock or timer?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:41 PM.


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