Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default 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
.



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
Auto Run Macro Dorci Excel Discussion (Misc queries) 2 February 5th 09 11:40 PM
Sub Macro vrs Function Macro Auto Start Pat Excel Discussion (Misc queries) 7 June 6th 07 09:53 PM
Run Auto Macro only once Jim D Excel Worksheet Functions 2 May 23rd 07 11:37 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Auto Run a Macro Pam Coleman Excel Discussion (Misc queries) 2 May 3rd 05 02:58 PM


All times are GMT +1. The time now is 06:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"