View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Application.OnTime driving me crazy

Formatted it as general. Worked fine for me.

xl97.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Mine was formatted as time as shown by the OP in the original post.

--
Regards,
Tom Ogilvy

"Lars-Åke Aspelin" wrote in message
...
On Sun, 31 Oct 2004 11:47:20 -0500, "Tom Ogilvy"
wrote:

Sub Tester1()
Range("D19").Select
ActiveSheet.Calculate
Application.OnTime ActiveCell.Value, "ABC"
MsgBox "done " & ActiveCell.Value
End Sub

Sub ABC()
MsgBox Format(ActiveCell.Value, "hh:mm:ss")
End Sub


Worked fine for me without using any format commands. the cell

contained
the
formula
=NOW()-INT(NOW())+TIME(0,0,5)

so it only contained a time.


It seems to have something with the actual formatting of the cell.
If the format is a "date" format (even with month name as text etc)
it works without calling the Format function, but if the cell format
is General or even Time (without the date part), then I will get the
Type mismatch when the cell value is given to the OnTime procedure.
So it is a bit strange that using Format with "hh:mm:ss" as a
parameter does note yield type mismatch as a cell format
of "hh:mm:ss" does.
All of this is experienced with Excel 2002.

Lars-Åke