ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto Run Macro (https://www.excelbanter.com/excel-programming/315787-auto-run-macro.html)

chris6562[_3_]

Auto Run Macro
 

I currently have a macro that kickes off every 4 min's my problem i
that it kicks off just at random times.. closer to every 4 second..
this is my code


Public dTime As Date
Sub MyMacro()
dTime = Now + TimeValue("00:04:00")
Application.OnTime dTime, "MyMacro"

Any Ideas?
Chri

--
chris656
-----------------------------------------------------------------------
chris6562's Profile: http://www.excelforum.com/member.php...fo&userid=1577
View this thread: http://www.excelforum.com/showthread.php?threadid=27528


Jim Rech

Auto Run Macro
 
You're saying the macro should run every 4 minutes but it does run every 4
seconds about? Your Timevalue string looks right. You could try this
instead:

dTime = DateAdd("n",4, now)

Make sure you start with a fresh Excel.

--
Jim Rech
Excel MVP
"chris6562" wrote in message
...
|
| I currently have a macro that kickes off every 4 min's my problem is
| that it kicks off just at random times.. closer to every 4 second...
| this is my code
|
|
| Public dTime As Date
| Sub MyMacro()
| dTime = Now + TimeValue("00:04:00")
| Application.OnTime dTime, "MyMacro"
|
| Any Ideas?
| Chris
|
|
| --
| chris6562
| ------------------------------------------------------------------------
| chris6562's Profile:
http://www.excelforum.com/member.php...o&userid=15772
| View this thread: http://www.excelforum.com/showthread...hreadid=275287
|




All times are GMT +1. The time now is 02:18 AM.

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