View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
TH[_3_] TH[_3_] is offline
external usenet poster
 
Posts: 38
Default Excel Timer with Sheet Toggle Help

Try this link to an excellent description of OnTime and more.
Also try this from VBA HELP ANSWER WIZARD: Timer Function Example
You can also find the OnTime function in HELP. I think this may be the best
option so you can do other things in the worksheet while it updates every
second. Don't forget to Cancel the timer when in the Workbook_BeforeClose
event otherwise it will keep running! (Unless you quit Excel entirely.)

Terry

On 4/13/04 18:03, in article
, "Tysone"
wrote:

Here is my VB text:


Dim Nexttime

Sub Toggle_sheets()
Dim i
Nexttime = Now + TimeValue("00:00:30")
i = ActiveSheet.Index + 1
Range("b1").Select
ActiveCell.FormulaR1C1 = ""
If i 4 Then i = 1
ActiveWorkbook.Worksheets(i).Activate
Application.OnTime Nexttime, "Toggle_sheets"
End Sub


And what I want to add is a timer inside of this so that:

Range("b1").Select
ActiveCell.FormulaR1C1 = ""

would happen every 00:00:01

Can someone help me?

Thanks


Tyson