![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Location: Robert P. Wagner
Posts: 22
|
Can you suspend processing an excel spread sheet for a period of time (say 1 second). So that when some vba code is hit, there is a timer that delays subsequent code executation for a specified amount of time?
|
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi
I use this little delayer in alot of my programs. To call it, just type SD NumOfSeconds For example, to delay your code for about a minute, put this in SD 60 It will call the Sub and stop for about 60 seconds. Place the code in a standard module Sub SD(LenTime) Dim Start Start = Timer Do While Timer < Start + LenTime DoEvents Loop End Sub Tom |
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Location: Robert P. Wagner
Posts: 22
|
Great, thanks Tom
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hey RP
Please edit the code as follows Sub SD(LenTime) Dim Start Start = Timer + LenTime Do While Timer < Start If Timer = 0 then Start = Timer + LenTime DoEvents Loop End Sub The code as I gave it to you befor will run an endless loop if it happens to run at midnight. Tom |
|
|
|
|
|
#5 |
|
New Member
Join Date: Feb 2002
Location: Robert P. Wagner
Posts: 22
|
Put the code in and it works great...thanks once again Tom..
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|