can we use Excel to create a countdown timer? when user enter the time, say, 530, countdown starts from 5:30
can we use Excel to create a countdown timer? when user enter the time, say, 530, countdown starts from 5:30
Bit of googling found this:
![]()
'Orginally posted by Geoffrey Hurst 'Orginal link http://www.mrexcel.com/archive/VBA/2357.html 'Put this in the Sheet module :- Private Sub CommandButton1_Click() Call Timer End Sub 'Put these in a normal module :- Dim CountDown As Date Sub Timer() CountDown = Now + TimeValue("00:00:01") Application.OnTime CountDown, "Reset" End Sub Sub Reset() Dim count As Range Set count = [A1] ' A1 contains the number of seconds for the countdown. count.Value = count.Value - 1 If count <= 0 Then MsgBox "Countdown complete." Exit Sub End If Call Timer End Sub Sub DisableTimer() On Error Resume Next Application.OnTime EarliestTime:=CountDown, Procedure:="Reset", Schedule:=False End Sub 'Put this in the Worbook module :- Private Sub Workbook_BeforeClose(Cancel As Boolean) Call DisableTimer ActiveWorkbook.Saved = True End Sub
Alibaba,
You'll need to continue this post to gain more support for your orginal question.
That mean i press Alt+F11 and type the code. But do I need to create a button first?
New user to VBA
can you help me with that?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks