Closed Thread
Results 1 to 9 of 9

Excel countdown timer code needed

  1. #1
    Registered User
    Join Date
    11-09-2014
    Location
    Las Vegas
    MS-Off Ver
    2013
    Posts
    2

    Question Excel countdown timer code needed

    Can you please write a code for the following cells; see attachment

    START
    PAUSE/UNPAUSE
    RESET

    When I click on the START cell, I want the "Time" cell to display 20:00 (twenty minutes) and begin counting down.

    I want to be able to Pause/UNPAUSE at anytime.

    When I click on the RESET cell, I want the time to reset to 20:00 (twenty minutes).

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Excel countdown timer code needed

    Hi SLStockwell and welcome to ExcelForum.

    Thank you for uploading your file, as it makes answering your question a lot easier.

    See the attached sample file which implements a 20 minute countdown timer. You should be able to adapt the code to your file. Please ask if you need additional help or have any questions.

    There are three parts to the code:
    a. ThisWorkbook module - startup and shutdown code.
    b. Generic Timer code in the Ordinary Code Modlue 'Mod20MinuteTimer'.
    c. Application specific Timer code in the Ordinary Code Modlue 'Mod20MinuteTimer'.

    Lewis

    ---------------------------------
    The complete code follows:
    ThisWorkbook module:
    Please Login or Register  to view this content.
    Ordinary Code module 'Mod20MinuteTimer':
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-09-2014
    Location
    Las Vegas
    MS-Off Ver
    2013
    Posts
    2

    Question Re: Excel countdown timer code needed

    Thank you for your help, Lewis! The updated spreadsheet is attached. Everything is working when I click on the different commands. I even incorporated the Ctrl keys; s-start, e-pause and r-reset. There is a delay in the countdown when I'm typing within a cell and wanted to know if that is normal or is there a way to get around that? It still keeps the correct count so really no big deal. Now, I would like to add an alarm sound when the timer reaches zero. Will you be able to help me?
    Shannon
    Attached Files Attached Files
    Last edited by SLStockwell; 11-11-2014 at 05:35 PM. Reason: Insert updated spreadsheet

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Excel countdown timer code needed

    Hi Shannon,

    Nicely done.

    There is a delay in the countdown when I'm typing within a cell.
    There may be a way to prevent the delay, but it is beyond my skill level. However, performance may be improved by putting the following command (that allows other Excel resources to be recognized during macro execution) anywhere in the 'ProjectSpecificEventHandler()' routine. That was an error of omission on my part.
    Please Login or Register  to view this content.
    All the following code has been tested and works in Excel 2003.

    -------------
    If you had speech enabled when you installed Excel, you may be able to use something like the following. Please note that if the speech sounds incorrect, phonetic spelling may improve what you hear.
    Please Login or Register  to view this content.
    ------------------------
    The following code will allow you to play an external .wav file. You will have to provide your own .wav file to run the following code. The code assumes the file is in the same folder as 'ThisWorkbook' (i.e. the file that is running the code). If the .wav file does not exist and/or can't be found, no sound will be played and there will be no error message. There are two versions, one with wait, and another without wait. The ability to play an internal embedded .wav file probably exists, but I never got that far.

    Please Login or Register  to view this content.
    Lewis
    Last edited by LJMetzger; 11-11-2014 at 06:10 PM.

  5. #5
    Registered User
    Join Date
    12-04-2014
    Location
    Benalla, Victoria, Australia
    MS-Off Ver
    2010
    Posts
    3

    Re: Excel countdown timer code needed

    Hi Guys

    The excel sheet of your works fantastic.

    I have tried changing the time period from 20 minutes to 30 minutes by changing every occurrence of the number 20 into 30.

    Could you let me know what I am doing wrong?

    Also If I wanted to have six of the timers running on the one sheet, how could I do this. Obviously copying the module and assigning the display to a new grid would not suffice.

    I need to track 6 fire fighting aircraft at once and they must make contact every thirty minutes or they are assumed as missing.

    Any help would be fantastic

    Regards Martin

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Excel countdown timer code needed

    Hi Martin and welcome to ExcelForum,

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    Since this is your first post, I will attempt to help you. See the file associated with post #4 in the following thread. http://www.excelforum.com/excel-prog...wn-timers.html

    If you need additional help, please do not use this thread. Start a new thread and reference any relevant threads.

    You will get the best and quickest response if you post a sample workbook.Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    Lewis

  7. #7
    Registered User
    Join Date
    02-15-2019
    Location
    Malta
    MS-Off Ver
    2017
    Posts
    12

    Re: Excel countdown timer code needed

    Hi,

    I would like to insert 2 of the the Application.Speech.Speak.

    My timer will be 60 seconds (this is for pool shot timer) and it needs to advice when 30 seconds remain and when time is up.

    How do I insert the below to be triggered at the correct time?

    Sub thirtyseconds()
    Application.Speech.Speak "30 seconds"
    End Sub
    Sub Timefoul()
    Application.Speech.Speak "Time Foul"
    End Sub

    Also, beside the countdown timer I would like to insert a progress bar to indicate, preferably turning red in the last 10 seconds

  8. #8
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Excel countdown timer code needed

    Hi bar807 and welcome to ExcelForum,

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    Since this is your first post, I will attempt to help you. See the file associated with post #4 in the following thread. http://www.excelforum.com/excel-prog...wn-timers.html

    If you need additional help, please do not use this thread. Start a new thread and reference any relevant threads.

    You will get the best and quickest response if you post a sample workbook.Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic


    ---------------------------------


    Administrative Note:
    When you make your post
    a. You can make a reference to the URL of this thread
    b. You MUST add 'code tags' or your question will not be answered.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

    Lewis

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,745

    Re: Excel countdown timer code needed

    Just to be clear: do NOT post your workbook here. Instead, start your own, new thread on this issue.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel Countdown Timer
    By MARKSTRO in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-07-2014, 06:51 PM
  2. [SOLVED] Macro needed to increase a cell value and start countdown timer
    By Klayton in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-08-2013, 08:34 AM
  3. How to make a countdown timer on Excel?
    By benyam in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-30-2012, 07:17 PM
  4. Creating a countdown timer on Excel?
    By darpa01 in forum Excel General
    Replies: 5
    Last Post: 12-14-2011, 11:55 AM
  5. Countdown timer Code not working
    By moses4u in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-02-2010, 12:42 PM

Tags for this Thread

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