ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   one-tenth of a second delay (https://www.excelbanter.com/excel-programming/294792-one-tenth-second-delay.html)

matt dunbar

one-tenth of a second delay
 
hi all

a really useful & simple bit of code introduces a one second delay
within a macro

Range("A1").Select
Application.Wait (Now + TimeValue("0:00:01"))
Range("A1").Select

can anybody trump this with a bit of code that gives a one-tenth of a
second delay please?

or is this the holy grail of code?

rise to the challenge please!?

TIA

matt

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Rob van Gelder[_4_]

one-tenth of a second delay
 
On my website is a link to "Subsecond Wait"

Code here for caching reference:

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sub test()
Sleep 500 'wait 1/2 second
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"matt dunbar" wrote in message
...
hi all

a really useful & simple bit of code introduces a one second delay
within a macro

Range("A1").Select
Application.Wait (Now + TimeValue("0:00:01"))
Range("A1").Select

can anybody trump this with a bit of code that gives a one-tenth of a
second delay please?

or is this the holy grail of code?

rise to the challenge please!?

TIA

matt

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




JWolf

one-tenth of a second delay
 
Application.wait (now + 0.0000011574074074)
Excel time values are stored to the right of the decimal point of the date.
The whole number is the number of days since 1/1/0 or 1/1/04 (depending
on system )
The fraction after the decimal point is the number of seconds since
midnight divided by
86400. (24 hrs * 60 minutes * 60 seconds = 86400 seconds per day).
Divide any exact time including fractional seconds by 86400 to get its
serial value.



matt dunbar wrote:
hi all

a really useful & simple bit of code introduces a one second delay
within a macro

Range("A1").Select
Application.Wait (Now + TimeValue("0:00:01"))
Range("A1").Select

can anybody trump this with a bit of code that gives a one-tenth of a
second delay please?

or is this the holy grail of code?

rise to the challenge please!?

TIA

matt

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


[email protected]

one-tenth of a second delay
 
try this
Application.Wait (Now + TimeValue("0:00:01")/2)

it is closer to one tenth of a second. if i remember
correctly i don't think it changes if you increase the 2
value.



-----Original Message-----
hi all

a really useful & simple bit of code introduces a one

second delay
within a macro

Range("A1").Select
Application.Wait (Now + TimeValue("0:00:01"))
Range("A1").Select

can anybody trump this with a bit of code that gives a

one-tenth of a
second delay please?

or is this the holy grail of code?

rise to the challenge please!?

TIA

matt

*** Sent via Developersdex http://www.developersdex.com

***
Don't just participate in USENET...get rewarded for it!
.


Rob van Gelder[_4_]

one-tenth of a second delay
 
As I understand it, Application.Wait does not do resolutions finer than 1
second.
If you ask it to wait until Now+1s, then that point in time may already be
1/2 a second away (or it may be a 1/10 second away or even 9/10 second away)


--
Rob van Gelder - http://www.vangelder.co.nz/excel


" wrote in
message ...
try this
Application.Wait (Now + TimeValue("0:00:01")/2)

it is closer to one tenth of a second. if i remember
correctly i don't think it changes if you increase the 2
value.



-----Original Message-----
hi all

a really useful & simple bit of code introduces a one

second delay
within a macro

Range("A1").Select
Application.Wait (Now + TimeValue("0:00:01"))
Range("A1").Select

can anybody trump this with a bit of code that gives a

one-tenth of a
second delay please?

or is this the holy grail of code?

rise to the challenge please!?

TIA

matt

*** Sent via Developersdex http://www.developersdex.com

***
Don't just participate in USENET...get rewarded for it!
.





All times are GMT +1. The time now is 10:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com