+ Reply to Thread
Results 1 to 11 of 11

Countdown timer

Hybrid View

  1. #1
    Registered User
    Join Date
    07-07-2013
    Location
    Northampton uk
    MS-Off Ver
    Excel 2010
    Posts
    146

    Countdown timer

    hi all

    ive attached a file for all to look at, on it is a countup timer but as im new to all this i dont know how to do a count down timer. there is more info on the file as to what im needing to do.

    can anyone please help

    thank you

    Attachment 248839

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Countdown timer

    Hi, flyinghigher2011,

    please do not start several threads on the same topic.

    Sub startTimer()
    Application.OnTime Now + TimeValue("00:00:01"), "increment_count"
    End Sub
    
    Sub increment_count()
    With Range("A3")
      .Value = .Value - 1
      If .Value = 0 Then
        RestartTimer
        MsgBox "Time´s up"
        UserForm2.Show
      Else
        startTimer
      End If
    End With
    End Sub
    
    Sub RestartTimer()
    On Error Resume Next
    Application.OnTime Now + TimeValue("00:00:01"), "increment_count", schedule:=False
    Range("A3").Value = 65
    End Sub
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    07-07-2013
    Location
    Northampton uk
    MS-Off Ver
    Excel 2010
    Posts
    146

    Re: Countdown timer

    it work great once i changed "sub RestartTimer" to "sub StopTimer" thank you very much. also one the pop up message "Times up" how do i get rid of the "Microsoft Excel" and put "Timer End" on it instead?

  4. #4
    Registered User
    Join Date
    04-24-2013
    Location
    cardiff
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Countdown timer

    Hi HighFlyer

    Where you have the code

    MsgBox "Times Up" you can edit this and type the message you require to pop up when the timer ends

    If you edit it to msgbox "Timer Up" this will pop up instead of time's up

  5. #5
    Registered User
    Join Date
    07-07-2013
    Location
    Northampton uk
    MS-Off Ver
    Excel 2010
    Posts
    146

    Re: Countdown timer

    Quote Originally Posted by Janto724 View Post
    Hi HighFlyer

    Where you have the code

    MsgBox "Times Up" you can edit this and type the message you require to pop up when the timer ends

    If you edit it to msgbox "Timer Up" this will pop up instead of time's up
    ive done that but what it need to say at the top is not "Microsoft Excel" but something else

  6. #6
    Registered User
    Join Date
    07-07-2013
    Location
    Northampton uk
    MS-Off Ver
    Excel 2010
    Posts
    146

    Re: Countdown timer

    it all works great now can i point you to another post that i have put up please

    http://www.excelforum.com/excel-prog...98#post3315998

    think i did that right and many thanks again

  7. #7
    Registered User
    Join Date
    07-07-2013
    Location
    Northampton uk
    MS-Off Ver
    Excel 2010
    Posts
    146

    Re: Countdown timer

    thanks again

    here is my final working code

    Sub startTimer()
    Application.OnTime Now + TimeValue("00:00:01"), "increment_count"
    End Sub
    
    Sub increment_count()
    With Range("H12")
      .Value = .Value - 1
      If .Value = 0 Then
        Range("H12").Value = 0
        MsgBox "Time´s up! How Did You Do This Time?"
        UserForm1.Show
      Else
        startTimer
      End If
    End With
    End Sub
    
    Sub StopTimer()
    On Error Resume Next
    Application.OnTime Now + TimeValue("00:00:01"), "increment_count", schedule:=False
    Range("H12").Value = 65
    End Sub
    and here is my code for start and stop buttons which disable when in use

    Private Sub Stop_End_Click()
    StopTimer
    STOP_END.Enabled = False
    CONTINUE.Enabled = True
    End Sub
    
    Private Sub CONTINUE_Click()
    Range("H12").Value = "65"
    
    startTimer
    STOP_END.Enabled = True
    CONTINUE.Enabled = False
    End Sub
    you are a star *****
    Last edited by flyinghigher2011; 07-10-2013 at 05:46 AM.

  8. #8
    Registered User
    Join Date
    04-24-2013
    Location
    cardiff
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Countdown timer

    Hi HighFlyer

    Have you given a name to the sheets or is it set to the default of Sheet 1 , Sheet 2

    Try naming the sheets to a name you want and try that

  9. #9
    Registered User
    Join Date
    07-07-2013
    Location
    Northampton uk
    MS-Off Ver
    Excel 2010
    Posts
    146

    Re: Countdown timer

    its all working fine bud but thanks for asking

  10. #10
    Registered User
    Join Date
    04-24-2013
    Location
    cardiff
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Countdown timer

    Okay glad it all working good for you

    If you are happy with everything I would click on Thread Tools and mark the thread as solved


  11. #11
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Countdown timer

    Hi, flyinghigher2011,

    MsgBox "Time´s up", vbInformation, "Message for you"
    Ciao,
    Holger

+ 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