View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Lars-Åke Aspelin Lars-Åke Aspelin is offline
external usenet poster
 
Posts: 30
Default Application.OnTime driving me crazy

On 31 Oct 2004 10:10:15 GMT, Ron
wrote:

Cheers guys, however I'm having problems placing the - Format(TimeCell2,
"hh:mm:ss") - code.

Where exactly does this go, and does it replace part of the original?


As I wrote in my response yesterday:

Replace the "TimeCell2" argument to TimeValue with

Format(TimeCell2, "hh:mm:ss")

That means that your code will end up like this

Sub OnTimeTest()
Dim TimeCell2 As String
TimeCell2 = Sheets("test").Range("F2")
Application.OnTime TimeValue(Format(TimeCell2, "hh:mm:ss")),
"testProcedure"
End Sub

and if you put the complete date and time in your F column cells, like
2004-10-31 14:47:00
then you can forget about the Format function.
Note that there should not be any " in the cell, just as shown above.


I've tried it in various locations and still coming up with errors.


Which locations have you tried?
Which errors do you get?

Lars-Åke


I'm going to try to put the whole date into the TimeCell2 and run the code
with Toms suggestion.

I'll also soldier on and try to figure the Format(TimeCell2) part as well.

Thanks,

Ron