ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Coninuously Running Time in Cell (https://www.excelbanter.com/excel-discussion-misc-queries/223001-coninuously-running-time-cell.html)

Randy

Coninuously Running Time in Cell
 
Is there a way of having today's time continuously running within a cell and
use it to "count down" the time remaining in other cells?

Thanks for your help!!

Randy

Mike H

Coninuously Running Time in Cell
 
Hi,

To get a running clock insert the code below in a general module. Run the
sub StartClock to strat the clock running and StopClock to stop it

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


"Randy" wrote:

Is there a way of having today's time continuously running within a cell and
use it to "count down" the time remaining in other cells?

Thanks for your help!!

Randy


Randy

Coninuously Running Time in Cell
 
Thanks Mike!

Would that be a VB module? If yes, all code below goes into one module?

Thanks again!

"Mike H" wrote:

Hi,

To get a running clock insert the code below in a general module. Run the
sub StartClock to strat the clock running and StopClock to stop it

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


"Randy" wrote:

Is there a way of having today's time continuously running within a cell and
use it to "count down" the time remaining in other cells?

Thanks for your help!!

Randy


Mike H

Coninuously Running Time in Cell
 
ALT+F11 to open vb editor, right click 'Thisworkbook' and insert module, the
code goes in there.

Mike

"Randy" wrote:

Thanks Mike!

Would that be a VB module? If yes, all code below goes into one module?

Thanks again!

"Mike H" wrote:

Hi,

To get a running clock insert the code below in a general module. Run the
sub StartClock to strat the clock running and StopClock to stop it

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


"Randy" wrote:

Is there a way of having today's time continuously running within a cell and
use it to "count down" the time remaining in other cells?

Thanks for your help!!

Randy


Randy

Coninuously Running Time in Cell
 
Perfect Mike....Thank You!

While I have your attention can you tell me how I can update workbook
information with have to close it and then re-open it?

"Mike H" wrote:

ALT+F11 to open vb editor, right click 'Thisworkbook' and insert module, the
code goes in there.

Mike

"Randy" wrote:

Thanks Mike!

Would that be a VB module? If yes, all code below goes into one module?

Thanks again!

"Mike H" wrote:

Hi,

To get a running clock insert the code below in a general module. Run the
sub StartClock to strat the clock running and StopClock to stop it

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


"Randy" wrote:

Is there a way of having today's time continuously running within a cell and
use it to "count down" the time remaining in other cells?

Thanks for your help!!

Randy



All times are GMT +1. The time now is 08:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com