View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default On time from cell time

I'm not usre what line you are getting this problem. I suspect that you are
trying to clear the event before you have set the event. You may need to use
another cell to check if the timer has been set or not set. Maybe an OnError
statement

Sub worksheet_change(ByVal target As Range)

For Each cell In target
If Not Application.Intersect(cell, Range("O2")) Is Nothing Then

On Error Resume Next
'cancell old on time event
Application.OnTime _
EarliestTime:=0, _
procedu="Assign", _
schedule:=False
On Error GoTo 0
If Err.Number < 0 Then
Application.OnTime _
EarliestTime:=TimeValue(target.Value), _
procedu="Assign", _
schedule:=True
End If
End If
Next cell

End Sub





"Kash" wrote:

I am getting below error

Method 'OnTime' of object'_Application' failed