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,excel vba delay,excel vba timer,vba time delay,excel vba time,delay vba,excel macro delay,excel vba time delay,vba timer,delay in vba,excel vba delay loop,timer vba excel,delay vba excel,timer in excel vba,excel vba pause seconds,time delay in vba,time delay vba,timer excel vba,timer vba,vba pause timer,0h,excel delay,excel macro time delay,insert date and time in excel,vba excel time delay,delay excel vba,delay macro,pause macro vba,time delay in excel vba,time delay vba excel,timer in vba excel,vba excel timer,vba insert pause,vba macro timer,vba pause,vba timer loop,1,delay excel macro,excel vba time function,excel vba time loop,excel visual basic time delay,pause between loop in vba,pause excel vba,timer macro vba,vba pause 1 second,vba pause macro,vba time,vba time loop,



Related Excel Tips

Comments

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