Countdown to an event?

Jimmasterton

New Member
Joined
Mar 13, 2018
Messages
36
Hi experts
I need some help please. I’m trying to make a countdown timer to the launch of a project. I want it to countdown DD:HH:MM:SS. I would like to put the event date in vba so that all you see when you open the workbook is a small ‘clock’ in the top corner of the screen.

I’ve got a ‘no ribbon’ minimal window set up already, but is it possible for the vba to know when to start the countdown again from after I close and open the workbook ? This timer will opened and closed frequently by multiple users.

Perhaps when the countdown reaches 00:00:00:00 a flashing “Project Launch!!”

Thanks guys
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
.
Paste into a Module :

Code:
Option Explicit


Public bTimerOn As Boolean


Sub ToggleTimer() ' This Sub will switch the automatic timer on if it was off before, and vice-versa
bTimerOn = Not bTimerOn


Refresh ' It calls the Refresh Sub
End Sub


Sub Refresh() ' This Sub calculates the sheet and tells Excel to call it again after 1 second
Application.Calculate


If bTimerOn Then ' If bTimerOn is True, start refreshing automatically
Application.OnTime Now + TimeValue("00:00:01"), "Refresh" ' The intervall is set to 1 second but can be changed variably
End If
End Sub

Download workbook : https://www.amazon.com/clouddrive/share/Y2aUfh2NfW2NpmPZ2FUms5y5xfnuye0GYU23PXPT8MV
 
Upvote 0
.

[Table="width:, class:head"][tr=bgcolor:#888888][th] [/th][th]
A
[/th][th]
B
[/th][th]
C
[/th][th]
D
[/th][th]
E
[/th][th]
F
[/th][/tr]
[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
1
[/td][td=bgcolor:#17375D]
Target Time
[/td][td=bgcolor:#17375D][/td][td=bgcolor:#8DB4E3]
12/3/2018 16:30
[/td][td=bgcolor:#17375D][/td][td=bgcolor:#17375D][/td][td=bgcolor:#17375D][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
2
[/td][td=bgcolor:#17375D]
[/td][td=bgcolor:#17375D][/td][td=bgcolor:#17375D]
Years
[/td][td=bgcolor:#17375D]
Months
[/td][td=bgcolor:#17375D]
Days
[/td][td=bgcolor:#17375D]
Hrs / Min /Sec
[/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
3
[/td][td=bgcolor:#17375D]
Remaining Time
[/td][td=bgcolor:#17375D][/td][td=bgcolor:#8DB4E3]
00
[/td][td=bgcolor:#8DB4E3]
2
[/td][td=bgcolor:#8DB4E3]
16
[/td][td=bgcolor:#8DB4E3]
5:21:14
[/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
4
[/td][td][/td][td][/td][td]Formula in C3:F3 =C1-Now()[/td][td][/td][td][/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
5
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
6
[/td][td][/td][td][/td][td]C1 : Custom Format m/d/yyyy hh:mm[/td][td][/td][td][/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
7
[/td][td][/td][td][/td][td]C3: Custom Format yy[/td][td][/td][td][/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
8
[/td][td][/td][td][/td][td]D3: Custom Format m[/td][td][/td][td][/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
9
[/td][td][/td][td][/td][td]E3: Custom Format d[/td][td][/td][td][/td][td][/td][/tr]


[tr=bgcolor:#FFFFFF][td=bgcolor:#888888]
10
[/td][td][/td][td][/td][td]F3: Custom Format h:mm:ss[/td][td][/td][td][/td][td][/td][/tr]
[/table]





In addition to the macro in my Post #2 (which goes in a Module), this macro goes in ThisWorkbook Module :

Code:
Option Explicit


Private Sub Workbook_Open()
    ToggleTimer
End Sub

You can choose to insert a Command Button on the worksheet that would be connected to the macro named "ToggleTimer". This would give you the ability
to turn off the timer if you want while the workbook is open. It is not necessary to have this button though. When the workbook is opened, the timer auto-starts.
 
Last edited:
Upvote 0
Many thanks Logit! This works very well, i’d like range A1:F6 to flash with ‘Project Complete!’ at 00 hrs, is this doable?
 
Upvote 0
I’m trying to display a message box when the countdown completely zeros. I’m having difficulty referencing the cell so I can userform.show. The cell zeros then goes to lots of #####, can anyone help?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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