ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   macro to recalculate every 10 seconds (https://www.excelbanter.com/excel-worksheet-functions/199662-macro-recalculate-every-10-seconds.html)

Paul Moles

macro to recalculate every 10 seconds
 
I am trying to use an Excel worksheet as a backdrop to a rolling Powerpoint
presentation. Their is no human intervention with the sheet or the
presentation once it is running.

I need a macro to recalcualate the sheet every few seconds or at least once
a minute to keep the presentation updated.

The links all work, (Excel highlighted cells, Copy, Powerpoint, Paste
special link) it is just the sheet update I need.

The sheet will be running in the background and the macro could be manually
started or an autorun when the workbook is opened.

Many Thanks

Paul Moles

Gary''s Student

macro to recalculate every 10 seconds
 
Public RunWhen As Double
Public Const cRunIntervalSeconds = 10
Public Const cRunWhat = "The_Sub"

Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub

Sub The_Sub()
Calculate
StartTimer
End Sub

Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub

begin by running StartTimer. The_Sub will run every 10 seconds.
finish by running StopTimer.


--
Gary''s Student - gsnu200801


"Paul Moles" wrote:

I am trying to use an Excel worksheet as a backdrop to a rolling Powerpoint
presentation. Their is no human intervention with the sheet or the
presentation once it is running.

I need a macro to recalcualate the sheet every few seconds or at least once
a minute to keep the presentation updated.

The links all work, (Excel highlighted cells, Copy, Powerpoint, Paste
special link) it is just the sheet update I need.

The sheet will be running in the background and the macro could be manually
started or an autorun when the workbook is opened.

Many Thanks

Paul Moles


Jarek Kujawa[_2_]

macro to recalculate every 10 seconds
 
see Chip Pearson's examples at
http://www.cpearson.com/excel/TimedClose.htm

one possible solution might be to use those 2 macros (tested in Excel
2003 and they worked)

Sub delay()
runwhen = Now + TimeSerial(0, 0, 10)
Application.OnTime runwhen, "recount", , True
End Sub

Sub recount()
For i =1 to 100
Call delay
Calculate
Next i
End Sub


All times are GMT +1. The time now is 05:24 PM.

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