$$Excel-Macros$$ Re: How to use timer in Excel VBA

2009-07-13 Thread lezley
One more thing: If you use variables and OnTime then never ever use the "End" command. Rather make a goto to the end of the sub. If you end the macro with "end" instead of "end sub" all variables will be deleted. --~--~-~--~~~---~--~~ --

$$Excel-Macros$$ Re: How to use timer in Excel VBA

2009-07-13 Thread lezley
As stated before sleep is not a good option as the user is not able to do anything in the meantime. application.ontime is a much better alternative. here an example: (m2 being the name of the macro that will be executed) time = Now + TimeValue("00:00:01") Application.OnTime time, "ThisWorkbook.m2"

$$Excel-Macros$$ Re: How to use timer in Excel VBA

2009-06-30 Thread zheng yu
Hi sleep 100 is not that good in that it freezes EXCEL completely. A better alternative is Application.onTime now+timevalue("00:00:10") you can find detailed documention on Excel Help On Tue, Jun 30, 2009 at 5:21 PM, Sandeep wrote: > Hi Anil, > I don't know much about VB but you c

$$Excel-Macros$$ Re: How to use timer in Excel VBA

2009-06-30 Thread Sandeep
Hi Anil, I don't know much about VB but you can try to use Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) . . "Code before sleep" . DoEvents sleep 100 . "code after sleep" . Public Declare Sub Sleep Lib "kernel32" (