#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default time delay

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default time delay

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default time delay

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default time delay

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
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
Time Delay for Macros [email protected] Excel Discussion (Misc queries) 1 May 15th 07 02:42 PM
Time delay function quartz[_2_] Excel Programming 4 November 10th 04 10:10 PM
Time Delay in VBA John Tolman[_2_] Excel Programming 3 October 27th 04 12:05 AM
Copy/Time Delay Mike Excel Programming 6 October 19th 04 02:26 PM
Time Delay Kilcup[_9_] Excel Programming 3 July 2nd 04 03:39 PM


All times are GMT +1. The time now is 04:43 PM.

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

About Us

"It's about Microsoft Excel"