Message PopUp issue

cdsaroma

Board Regular
Joined
Feb 5, 2003
Messages
200
I have this code below:

Code:
Private Const reminder As Integer = 1
Private reminderNext As Variant

Public Sub remindMe()

  
    myrows = Range("A1").CurrentRegion.Rows.Count
    TODAY = Date
     
    For thisrow = 2 To myrows
        If (Cells(thisrow, "C") = "x") Then
         
            thisdate = CDate(CDate(Cells(thisrow, "A")))
             
            If (thisdate >= TODAY) Then
                 
                    task = task & vbCrLf & " Call " & Cells(thisrow, "B") & " " & Format(Cells(thisrow, "D"))
               
            End If
        End If
     
    Next
     
    If (task <> "") Then MsgBox task
     
     
    reminderNext = Now + TimeSerial(0, reminder, 0)
    Application.OnTime reminderNext, "ThisWorkbook.remindMe", , True
     
End Sub

Private Sub Workbook_Open()

Call remindMe

End Sub
rows:
A= date column
B= persons name
C= x
D= text Today

It works but it seems to loop even if I press OK on the box. Sometimes I have to press it 5 times before it will go away.
Is there a way to stop the macro once the OK button is pressed?
(of course macro will start again on wookbook open which is correct)
In another words I only want it to run once per wookbook open if the criteria (todays date) is met.

thanks
Paul
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I think I worked it out.
I removed this:
Code:
reminderNext = Now + TimeSerial(0, reminder, 0)
    Application.OnTime reminderNext, "ThisWorkbook.remindMe", , True
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top