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")
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")
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
Thanks Leith!! Works Great!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks