time delay

  • Thread starter Thread starter RobcPettit
  • Start date Start date
R

RobcPettit

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
 
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

:
| 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
|
 
You're welcome.

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Thankyou Dave, I will give that a go today.
| RegardS Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top