View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Wait Seconds and Tenths

Zone,

Try the following code:

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub FallAsleep()
Dim Seconds As Long
Dim Tenths As Long
Dim SleepTime As Double
Seconds = Range("A1").Value
Tenths = Range("B1").Value
SleepTime = ((Seconds * 1000) + (Tenths * 100))
Debug.Print "Ready To Sleep: " & CStr(SleepTime)
Sleep dwMilliseconds:=SleepTime
Debug.Print "Wake Up"
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Zone" wrote in message
ps.com...
I want to put a whole number in a cell, say A1, to represent seconds,
and another whole number in a cell, say B1, to represent tenths (or
hundredths) of a second. How do I get my macro to pause for this
amount of time? Please specify type of any variables! Thanks, James