+ Reply to Thread
Results 1 to 5 of 5

countdown timer

Hybrid View

  1. #1
    Registered User
    Join Date
    12-21-2006
    Posts
    21

    countdown timer

    can we use Excel to create a countdown timer? when user enter the time, say, 530, countdown starts from 5:30

  2. #2
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: countdown timer

    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

  3. #3
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: countdown timer

    Alibaba,

    You'll need to continue this post to gain more support for your orginal question.

  4. #4
    Registered User
    Join Date
    12-21-2006
    Posts
    21

    Re: countdown timer

    That mean i press Alt+F11 and type the code. But do I need to create a button first?

    New user to VBA

  5. #5
    Registered User
    Join Date
    12-21-2006
    Posts
    21

    Re: countdown timer

    can you help me with that?
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1