View Single Post
  #9   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,

I have used your code in some other similar sheet. The code used is given
below.

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

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

iEnd = Sheet1.Range("H5").End(xlDown).Row
Set rng = Sheet1.Range("H5:H" & iEnd)
For Each c In rng
If c - Now() 0 And c - Now() < 0.125 Then _
MsgBox c.Offset(0, -5) & " is about to cross SLA on " & Format(c,
"dd.mm.yy hh:mm:ss AM/PM"), vbInformation, "Please Check SLA"
Next c
Application.OnTime Now() + TimeValue("00:00:10"), "CheckEndTime"
End Sub

The code is showing a pop up but after showing the pop up it also shows an
error i.e.

Run-time error '13':
Type mismatch

After clicking on Debug, Following line of code gets selected.
If c - Now() 0 And c - Now() < 0.125 Then _

If you could help me out again this time, It would be a great act of
kindness to me.

Thanks a lot in advance,
Jitendra




"merjet" wrote:

Now, It is poping up when the end time has passed.
I want it to pop when there is 3 hours left to reach the end time.
I mean it should throw a reminder so that the order should not cross end time.


Then my guess is that your code differs (logically) from mine. My
variable 'c' cycles through the end times. If c is past, then c -
Now() < 0 and the first if-condition fails.

Please be so kind to explain the logic of 0.125 which you have used in the
code.


0.125 = 1/8 3 hrs = 1/8 * 24 hrs

Hth,
Merjet