Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I have live data streeming into a worksheet. Then I have a vba code
in the 'worksheet calculate'. 8 out of 10 times all works well. But for those 2 times, my live data might glitch for a second or two(internet connection times out, etc). Result bieng that all the data has not fully updated, but the macro will cause to fire. I s there a way of adding a 2 second delay when the macro fires. Regards Robert |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try something like this.
Dim mytime As Date Dim mydelay As Single Dim myseconds As Integer myseconds = 2 If myseconds 0 Then mydelay = myseconds / 86400 Else Exit Sub End If mytime = Now() Do While Now() < mytime + mydelay DoEvents Loop -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "RobcPettit" wrote: | Hi, I have live data streeming into a worksheet. Then I have a vba code | in the 'worksheet calculate'. 8 out of 10 times all works well. But for | those 2 times, my live data might glitch for a second or two(internet | connection times out, etc). Result bieng that all the data has not | fully updated, but the macro will cause to fire. I s there a way of | adding a 2 second delay when the macro fires. | Regards Robert | |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thankyou Dave, I will give that a go today.
RegardS Robert Dave Patrick wrote: Try something like this. Dim mytime As Date Dim mydelay As Single Dim myseconds As Integer myseconds = 2 If myseconds 0 Then mydelay = myseconds / 86400 Else Exit Sub End If mytime = Now() Do While Now() < mytime + mydelay DoEvents Loop -- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "RobcPettit" wrote: | Hi, I have live data streeming into a worksheet. Then I have a vba code | in the 'worksheet calculate'. 8 out of 10 times all works well. But for | those 2 times, my live data might glitch for a second or two(internet | connection times out, etc). Result bieng that all the data has not | fully updated, but the macro will cause to fire. I s there a way of | adding a 2 second delay when the macro fires. | Regards Robert | |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You're welcome.
-- Regards, Dave Patrick ....Please no email replies - reply in newsgroup. Microsoft Certified Professional Microsoft MVP [Windows] http://www.microsoft.com/protect "RobcPettit" wrote: | Thankyou Dave, I will give that a go today. | RegardS Robert |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Time Delay for Macros | Excel Discussion (Misc queries) | |||
Time delay function | Excel Programming | |||
Time Delay in VBA | Excel Programming | |||
Copy/Time Delay | Excel Programming | |||
Time Delay | Excel Programming |