Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default timer ticker

Hiya,

I need a cell in my worksheet (A4) to always show the current time (to the
minute). All I want to do is get excel to calculate every 60 seconds.

I've tried all sorts and using Pearson's stuff with application.ontime on
various options like workbook open, worksheet activate etc etc, but it don't
do sheet if you know what I mean.

I've also looked into 'timer' but I can't figure out how to make it work for
me.

It's is so so so so so so darned simple what I'm asking for... I'm
absolutely shocked I can't find it when I've searched everywhere on here for
it!

Can you help please?

Frustrated B
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default timer ticker

Hi,

Try this

Sub Clock()
ThisWorkbook.Sheets("Sheet1").Range("A4").Value = CDbl(Time)
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "Clock"
End Sub

Mike

"Basil" wrote:

Hiya,

I need a cell in my worksheet (A4) to always show the current time (to the
minute). All I want to do is get excel to calculate every 60 seconds.

I've tried all sorts and using Pearson's stuff with application.ontime on
various options like workbook open, worksheet activate etc etc, but it don't
do sheet if you know what I mean.

I've also looked into 'timer' but I can't figure out how to make it work for
me.

It's is so so so so so so darned simple what I'm asking for... I'm
absolutely shocked I can't find it when I've searched everywhere on here for
it!

Can you help please?

Frustrated B

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default timer ticker

Thanks for your speedy and good help.

I need to be able to stop it when I close the workbook rather than it try
and reopen the book immediately after. Can you help?

B

"Mike H" wrote:

Hi,

Try this

Sub Clock()
ThisWorkbook.Sheets("Sheet1").Range("A4").Value = CDbl(Time)
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "Clock"
End Sub

Mike

"Basil" wrote:

Hiya,

I need a cell in my worksheet (A4) to always show the current time (to the
minute). All I want to do is get excel to calculate every 60 seconds.

I've tried all sorts and using Pearson's stuff with application.ontime on
various options like workbook open, worksheet activate etc etc, but it don't
do sheet if you know what I mean.

I've also looked into 'timer' but I can't figure out how to make it work for
me.

It's is so so so so so so darned simple what I'm asking for... I'm
absolutely shocked I can't find it when I've searched everywhere on here for
it!

Can you help please?

Frustrated B

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default timer ticker

Have done it.

Thanks for tip. Here is full solution:

On workbook module:
Private Sub Workbook_Open()
StartClock
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopClock
End Sub

In module1:
Option Explicit
Public NextTick

Sub StartClock()
ThisWorkbook.Sheets("Sheet1").Range("A4").Value = Now
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "StartClock"
End Sub

Sub StopClock()
Application.OnTime NextTick, "StartClock", , False
End Sub

Thanks for help, do please tell if I can tidy / shove it all into the
workbook/worksheet modules (I hate having a 'modules' folder if I don't need
one!

Basil

"Basil" wrote:

Thanks for your speedy and good help.

I need to be able to stop it when I close the workbook rather than it try
and reopen the book immediately after. Can you help?

B

"Mike H" wrote:

Hi,

Try this

Sub Clock()
ThisWorkbook.Sheets("Sheet1").Range("A4").Value = CDbl(Time)
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "Clock"
End Sub

Mike

"Basil" wrote:

Hiya,

I need a cell in my worksheet (A4) to always show the current time (to the
minute). All I want to do is get excel to calculate every 60 seconds.

I've tried all sorts and using Pearson's stuff with application.ontime on
various options like workbook open, worksheet activate etc etc, but it don't
do sheet if you know what I mean.

I've also looked into 'timer' but I can't figure out how to make it work for
me.

It's is so so so so so so darned simple what I'm asking for... I'm
absolutely shocked I can't find it when I've searched everywhere on here for
it!

Can you help please?

Frustrated B

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default timer ticker

Why bother with the timer, why not save the workbook every 60 secs

Public nTime as Double

Sub Clock()
ThisWorkbook.Save
nTime = Now + TimeValue("00:01:00")
Application.OnTime nTime, "Clock"
End Sub


and in ThisWorkbook


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Ontime nTime,"Clock",,False
End Sub

--
HTH

Bob

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

"Basil" wrote in message
...
Thanks for your speedy and good help.

I need to be able to stop it when I close the workbook rather than it try
and reopen the book immediately after. Can you help?

B

"Mike H" wrote:

Hi,

Try this

Sub Clock()
ThisWorkbook.Sheets("Sheet1").Range("A4").Value = CDbl(Time)
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "Clock"
End Sub

Mike

"Basil" wrote:

Hiya,

I need a cell in my worksheet (A4) to always show the current time (to
the
minute). All I want to do is get excel to calculate every 60 seconds.

I've tried all sorts and using Pearson's stuff with application.ontime
on
various options like workbook open, worksheet activate etc etc, but it
don't
do sheet if you know what I mean.

I've also looked into 'timer' but I can't figure out how to make it
work for
me.

It's is so so so so so so darned simple what I'm asking for... I'm
absolutely shocked I can't find it when I've searched everywhere on
here for
it!

Can you help please?

Frustrated B





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default timer ticker

Because it takes a lot longer to save the workbook.

I improved the code further. I entered in the NOW() function into cell A4,
and used this StartClock code instead:

Sub StartClock()
Calculate
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "StartClock"
End Sub

This is the only function on the sheet so it works just as quick, but the
key benefit is that when the other bits of code are running, the ticker will
still continue to tick (unlike the previous solution where it would pause).

B

"Bob Phillips" wrote:

Why bother with the timer, why not save the workbook every 60 secs

Public nTime as Double

Sub Clock()
ThisWorkbook.Save
nTime = Now + TimeValue("00:01:00")
Application.OnTime nTime, "Clock"
End Sub


and in ThisWorkbook


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Ontime nTime,"Clock",,False
End Sub

--
HTH

Bob

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

"Basil" wrote in message
...
Thanks for your speedy and good help.

I need to be able to stop it when I close the workbook rather than it try
and reopen the book immediately after. Can you help?

B

"Mike H" wrote:

Hi,

Try this

Sub Clock()
ThisWorkbook.Sheets("Sheet1").Range("A4").Value = CDbl(Time)
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "Clock"
End Sub

Mike

"Basil" wrote:

Hiya,

I need a cell in my worksheet (A4) to always show the current time (to
the
minute). All I want to do is get excel to calculate every 60 seconds.

I've tried all sorts and using Pearson's stuff with application.ontime
on
various options like workbook open, worksheet activate etc etc, but it
don't
do sheet if you know what I mean.

I've also looked into 'timer' but I can't figure out how to make it
work for
me.

It's is so so so so so so darned simple what I'm asking for... I'm
absolutely shocked I can't find it when I've searched everywhere on
here for
it!

Can you help please?

Frustrated B




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
Chart ticker chewymeeh Charts and Charting in Excel 1 September 27th 06 03:02 PM
Ticker Boxes hustla7 Excel Discussion (Misc queries) 3 August 19th 06 10:45 PM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
Time ticker Soniya[_4_] Excel Programming 6 October 3rd 05 04:49 PM
Ticker Symbol Jeff Excel Discussion (Misc queries) 0 February 5th 05 04:31 PM


All times are GMT +1. The time now is 01:06 AM.

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"