ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   auto run a macro (https://www.excelbanter.com/excel-programming/273993-auto-run-macro.html)

garima agrawal

auto run a macro
 
Hi,

I want to run a macro inMS excel, in specific time
intervals automatically. I need to update my data and
calculations in every five minutes for that I am using
formulas and macros.

Will it be possible to run a macro automaically, like auto
refresh facility in MS excel.

Thanks

Garima

John Green[_2_]

auto run a macro
 
Garima,

Use the OnTime method to schedule a macro. The following code (from Bill Manville, originally) shows how to repeat the same code
every ten seconds:

Dim NextTime As Date

Sub DoItRepeatedly()
DoItAgain
End Sub

Sub DoItAgain()
DoIt ' this is your procedure
NextTime = Now + TimeValue("00:00:10") ' 10 seconds on
Application.OnTime NextTime, "DoItAgain"
End Sub

Sub StopDoingIt()
Application.OnTime NextTime, "DoItAgain", schedule:=False
End Sub

Sub Auto_Close() ' otherwise it will re-open and do it again!
StopDoingIt
End Sub


--

John Green - Excel MVP
Sydney
Australia


"garima agrawal" wrote in message ...
Hi,

I want to run a macro inMS excel, in specific time
intervals automatically. I need to update my data and
calculations in every five minutes for that I am using
formulas and macros.

Will it be possible to run a macro automaically, like auto
refresh facility in MS excel.

Thanks

Garima




Neil[_11_]

auto run a macro
 
Chong/Garima

Have a look at Chip Pearsons's Ontime page
http://www.cpearson.com/excel/ontime.htm

Neil

"Chong Moua" wrote in message
...
Hi Garima,

I don't know of an easy way to set macros to run every
five minutes. What could work is to use the events
feature. Everytime a particular cell or sheet changes
then the macro runs.

Hope this helps...

Chong Moua

-----Original Message-----
Hi,

I want to run a macro inMS excel, in specific time
intervals automatically. I need to update my data and
calculations in every five minutes for that I am using
formulas and macros.

Will it be possible to run a macro automaically, like

auto
refresh facility in MS excel.

Thanks

Garima
.





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

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