Start a daily countdown reminder from certain date

Ironman

Well-known Member
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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.

Akuini

Well-known Member
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``````

Ironman

Well-known Member
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

Akuini

Well-known Member
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
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``````

Ironman

Well-known Member
Ah, that's great, many thanks again Akuini!

Replies
17
Views
327
Replies
1
Views
241
Replies
3
Views
329
Replies
3
Views
107
Replies
1
Views
393

1,148,334
Messages
5,746,162
Members
423,997
Latest member
moofish87

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.

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

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