View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jitendra Kumar[_2_] Jitendra Kumar[_2_] is offline
external usenet poster
 
Posts: 16
Default Pop up based on criteria

Hi Merjet,

Many thanks for the help and sorry for providing incomplete information.
I pasted the below code in a module and in workbook_open event I pasted the
sub name "StartTimer" but unfortunately it is not working.

I don't know why it is giving an error.
please help.

Regards,

"merjet" wrote:

You didn't say anything about the user having to do anything to get
the pop-up or how often it could occur. The following requires the
user to start the timer, which will fire every 15 minutes. You could
start the process from Workbook_Open().

Sub StartTimer()
Application.OnTime Now() + TimeValue("00:15:00"), "CheckEndTime"
End Sub

Sub CheckEndTime()
Dim iEnd As Integer
Dim c As Range
Dim rng As Range
Dim ws As Worksheet

Set ws = Sheets("Sheet1")
iEnd = ws.Range("C1").End(xlDown).Row
Set rng = ws.Range("C2:C" & iEnd)
For Each c In rng
If c - Now() < 0.125 And c - Now() 0 Then _
MsgBox "Order " & c.Offset(0, -2) & " has end time " & c
Next c
Application.OnTime Now() + TimeValue("00:15:00"), "CheckEndTime"
End Sub

Hth,
Merjet