Start a daily countdown reminder from certain date

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
Hi

The below code, currently commented out in the Workbook_Open event, counts down (i.e. the number of days remaining reduces in each daily msgbox) until Jan 1 to remind me to update some code.

VBA Code:
MsgBox "Reminder: Today's Date is " & Date, vbInformation, "New Year Update Countdown" & vbNewLine _
            & "New Year Updates due in " & (Range("VBADaysLeft"))+1 & " days", vbInformation , "Exercise Log"

[The named range "VBADaysLeft" is DATE(YEAR(TODAY()),12,31)-LOOKUP(10^35,A:A) and works perfectly OK]

The problem is, it's commented out because I don't want the above to start running until 25 December each year but I will need reminding the week before the new year each year.

Can this be automated so I start receiving the daily reminder when I open the workbook between 25 December and 1 January, and not just on 25 December? (else I would simply insert the below line)
VBA Code:
If Date = DateSerial(Year(Now), 12, 25) Then

Thanks!
 
Last edited:

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I think the tricky part is 1 January, because the Year(Now) will be different.
Why not use the exact year, something like this:
VBA Code:
Dim x As Long
If Date >= DateSerial(2021, 12, 25) And Date <= DateSerial(2022, 1, 1) Then
x = DateSerial(2022, 1, 1) - Date
MsgBox x
End If
 
Upvote 0
That looks good Akuini, many thanks for your solution - I just have to hope with my ageing memory that I'll remember to adjust the DateSerial :biggrin:
 
Upvote 0
You're welcome, glad to help & thanks for the feedback.:)
I just have to hope with my ageing memory that I'll remember to adjust the DateSerial
How about this:
VBA Code:
Dim x As Long
 
 If Format(Date, "mm-dd") = "01-01" Then
    MsgBox "0"
 Else
    If Date >= DateSerial(Year(Now), 12, 25) And Date <= DateSerial(Year(Now), 12, 31) Then
        x = DateSerial(Year(Now), 12, 31) + 1 - Date
        MsgBox x
    End If
 End If
 
Upvote 0
Solution
Ah, that's great, many thanks again Akuini!
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,865
Members
449,052
Latest member
Fuddy_Duddy

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