Codes for Reminder creation in Excel VBA

Solved/Closed
koyel - Mar 13, 2010 at 02:29 AM
 vivek - May 17, 2011 at 11:20 PM
Hello,

I want to get Reminder message box automatically, according to the date and time in Excel worksheet.
What are the VBA codings & procedures? Pls help...
Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Mar 13, 2010 at 11:04 AM
Design your sheet as

---A -------------- B -------- C ---------------------- D
1- Date ------- Time ------Task ------------------- Remind
2- 13/3/2010 - 11:10 ---- Clean Room -------------- X
3- 13/3/2010 - 11:10 ---- Clean Car ----------------- X

X: indicate the this is an active reminder. Remove x to disable that reminder

On VBE (ALT + F11) and in the project explorer window, double click on "ThisWorkbook". Paste the code below.

Private Const reminder As Integer = 1 
Private reminderNext As Variant 

Public Sub remindMe() 

    currentTime = Time 
    nextMin = CDate(Format(Time + 1 / (24 * 60), "hh:mm")) 
     
    myrows = Range("A1").CurrentRegion.Rows.Count 
     
    For thisrow = 2 To myrows 
        If (Cells(thisrow, "D") = "X") Then 
         
            thistime = CDate(CDate(Cells(thisrow, "A")) + Cells(thisrow, "B")) 
             
            If ((thistime >= Now) And (thistime <= Now + 1 * reminder / (24 * 60))) Then 
                 
                    task = task & vbCrLf & Cells(thisrow, "C") & " at " & Format(Cells(thisrow, "B"), "hh:mm") 
               
            End If 
        End If 
     
    Next 
     
    If (task <> "") Then MsgBox task 
     
     
    reminderNext = Now + TimeSerial(0, reminder, 0) 
    Application.OnTime reminderNext, "ThisWorkbook.remindMe", , True 
     
End Sub 





Also you need to understand a few things
1. The code needs to be started manually first time. After that till you close the book, it will keep checking the schedule as you have defined in the book

2. Once you close the book and relaunch it, you again have to start the code once more.

3 . To start the code, you would need to go to macro and there is a run button on the menu bar.

4. Now if you don't want to manually run the code, and you want the code to run on its own when ever you start the book, then you have to define a routine called Workbook_Open()

5 So again, If you want to manually run the code then you do exactly as you did before
and if you want to run the code on its own when ever the book is opened, then you need to add one more (you keep the old code though). The code would be

Private Sub Workbook_Open()

Call remindMe

End Sub
53
I have tried to copy the above codes but I'm not getting any reminder. I would love to know how to set the reminders, as I need to be reminded by MS Excel 2007 re-reporting deadlines I have set in my workbook. Thanks in advance.
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Apr 12, 2010 at 09:03 AM
Did you follow the instructions about where to paste the code ?
0
I would love to know how does its work I tried your code but its not working plz tell. There is no any reminder on my task bar plz give me any idea to do this
I realy like to do this plz tell me what m I suppose to do
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 27, 2010 at 03:00 PM
SadAnand, dont be so sad man.
Now for your question. There is no reminder on the taskbar. This issue was some one wanted to have excel running in the background or launched via scheduler. The excel book itself would act as a reminder.
0
Hi rizvisa

I copy and pasted your code exactly as per mention above but it cant work

My step wht I do
1. I copy above code
2. Open the excel and press Alt F11 then VB window open
3. I pasted there the code
4. I saved that excel on desktop
5. and re-open the same excel
6. in A2 I wrote 01/06/1020 (dd/mm/yy) & B2 I wrote 01:10 (night timing that is am)
7. in C2 I wrote My bill due date is today
8. in D2 I wrote X (alphabetical capital letter)
9. I saved this and close the excel

On camputor time comes 01:11 but on task bar there no any reminder (In B2 I wrote 01:10 time)
its not working Plz help
0