ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Wait time variable (https://www.excelbanter.com/excel-programming/344392-wait-time-variable.html)

Brian Matlack[_20_]

Wait time variable
 

Hi!
In the code listed below, how can I make the Time Value refer to a cell
on the worksheet?
Thanks
Application.Wait Format(Now + TimeValue("00:00:01"), "hh:mm:ss")


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=480861


Leith Ross[_180_]

Wait time variable
 

Hello Brian,

EXAMPLE:
Place your time delay in seconds in cell $A$1 of the Active Worksheet.
This example uses 1 second.

$A$1 = 1
Application.Wait (Now + TimeSerial(0, 0, Range("$A$1").Value)

To access a $A$1 (or any cell you choose) on another Worksheet...
Application.Wait (Now + TimeSerial(0, 0,
Worksheets("Sheet2").Range("$A$1").Value)

The advantages TimeSerail has over TimeValue are TimeSerial will still
yield the correct time if there is an overflow in a placeholder and it
doesn't require formating the cell as a String.

If n = 62 or 62 seconds, TimeSerial(0, 0, n) will convert correctly to
1 minute and 2 seconds. Setting TimeValue with seconds greater than 59
generates an error. So, TimeValue("00:00:" & n) won't work.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=480861


Brian Matlack[_21_]

Wait time variable
 

Thanks Leith!! Works Great!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=480861



All times are GMT +1. The time now is 05:45 PM.

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