Insert Introduce Time Delay in Macro Vba

July 28, 2009 by vba excel
Filed under: Excel Vba 
Sponsor

Excel Vba Macro : Insert Introduce Time Delay in Macro Vba [Q]
Does anyone know how to introduce a time delay into excel VBA macros? I created an excel macro that runs an application on about 15 different excel worksheets. I want to be able to have the macro pause between excel worksheets, to allow this application to have enough time to download on every sheet. Is this possible? If so, what excel vba macro code would I need?

Excel Vba Macro : Insert Introduce Time Delay in Macro Vba [A]
This is excel vba macro code that can be putted into the standard module as a public declaration at the top of the module and called at anytime by simply typing:

HalfSecDly

on a line by itself in your code.

Public Function HalfSecDly()
y = Timer + 0.5
Do While Timer < y
DoEvents
Loop
End Function

You can create other functions for different time delays by changing the 0.5
to another number. i.e. 0.1 = tenth second, 1 = one second 10 = 10 seconds, etc. There is a way to set it up for microseconds but I find tenths to be good
enough.

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google
  • E-mail this story to a friend!
  • Live
  • MisterWong
  • Propeller
  • StumbleUpon
  • Technorati
  • TwitThis
  • YahooMyWeb
  • Print this article!

Rate This Tips:

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.00 out of 5)
Loading ... Loading ...


Incoming excel search terms

vba delay,excel vba pause,vba time delay,excel vba delay,excel macro delay,excel vba time,excel macro time delay,delay vba,excel vba timer,excel vba time delay,vba pause,delay in vba,excel delay,mss,time delay vba,vba timer,timer vba excel,excel vba delay loop,macro delay,pause macro vba,timer excel vba,timer in excel vba,timer vba,delay vba excel,vba delay seconds,,delay macro,pause vba excel,time delay in vba,vba excel delay,vba pause macro,vba timer loop,delay excel macro,excel time delay,excel vba pause seconds,vba excel pause,vba insert delay,delay macro excel,excel vba pause macro,time delay excel vba,vba excel timer,vba insert pause,vba pause timer,vba time loop,excel macro pause,excel vba insert delay,macro time delay,pause excel vba,time delay vba excel,vba excel time delay



Related Excel Tips

Comments

Have another excel answer or questions for this problem ?
Feel free to post it here..