+ Reply to Thread
Results 1 to 14 of 14

How to create an Stopwatch (chronometer) using two buttons.

  1. #1
    Registered User
    Join Date
    09-24-2015
    Location
    Portugal
    MS-Off Ver
    Mac
    Posts
    14

    How to create an Stopwatch (chronometer) using two buttons.

    Hi,

    I'm trying to create a chronometer in excel using only two buttons start/Stop and reset using VBA, however I can't achieve that. I want that the value appeared only in one cell, and when i reset the counting, that cell appears with zeros and ready to count again. The main function is to count (in soccer) the time that my team lost to recover the ball. I'm using excel 2011 for macbook.... I've tried some codes, however the ones tht work appears the values according to time, and not like an choronometer.

    Someone can help me?

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: How to create an Stopwatch (chronometer) using two buttons.

    Have you checked this one: http://www.excelforum.com/excel-prog...stopwatch.html ?
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    09-24-2015
    Location
    Portugal
    MS-Off Ver
    Mac
    Posts
    14

    Re: How to create an Stopwatch (chronometer) using two buttons.

    Thank you Kaper.

    This helps a lot. However, this code write the time in a new line everytime that i click stop and start, and i want that stay always the same cell recording, stoping and return to zero, and start again. Is that possible?

    Thanks a lot.

    Best regards,

    Diogo

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: How to create an Stopwatch (chronometer) using two buttons.

    Well, I just wanted to show you a working mechanism.

    Dig a bit in the code and you will see, that the result is written in LastCellInA and this range is always changing.

  5. #5
    Registered User
    Join Date
    09-24-2015
    Location
    Portugal
    MS-Off Ver
    Mac
    Posts
    14

    Re: How to create an Stopwatch (chronometer) using two buttons.

    And I appreciate, but i have a lot of dificulties in coding. I've been trying to change that code, the result is always the same, the macro gives error.
    Last edited by DiogoamCoutinho; 09-24-2015 at 12:34 PM.

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: How to create an Stopwatch (chronometer) using two buttons.

    OK, I did some changes in the attached file.
    As I do not have Mac handy, tried to write rather "simple - no tricks" code.
    Try it. I splitted it into smaller procedures - may be will be easier to follow how it works (if works - in Win environment it does work).
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-24-2015
    Location
    Portugal
    MS-Off Ver
    Mac
    Posts
    14

    Re: How to create an Stopwatch (chronometer) using two buttons.

    Thank you so much Kaper. It works perfect. Could help me with one more thing please? When I try to copy the code to my excel worksheet, it gives me always a problem in this code line "If timercell Is Nothing Then". I want the code in row AF and line 26, and I change it, however when set a macro to the button it gives me that error. I will attach a picture of the excel worksheet and of the code. Captura de ecrã 2015-09-25, às 08.47.13.png Captura de ecrã 2015-09-25, às 08.48.47.png

  8. #8
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: How to create an Stopwatch (chronometer) using two buttons.

    1) in immediate window write
    Please Login or Register  to view this content.
    or just close excel totally and reopen the file
    2) make sure you use allowed numberformat (in VBA it is still English version with dot as decimal separator)
    3) see pictures and spot one more difference :-P (seriously: a sppreadsheet is much better attachment than screenshot alone - even if it shows rows/columns headers)
    Attached Images Attached Images

  9. #9
    Registered User
    Join Date
    09-24-2015
    Location
    Portugal
    MS-Off Ver
    Mac
    Posts
    14

    Re: How to create an Stopwatch (chronometer) using two buttons.

    I've tried to change but stell have problems. I'm not sure of how to attach files, so i will sent you and dropbox link of what i'm working with.

    https://www.dropbox.com/s/jhs8az9f08...test.xlsm?dl=0

    I hope that you could hep me... i've been trying all the week, but i still can't do want i want =/

  10. #10
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: How to create an Stopwatch (chronometer) using two buttons.

    As for attaching a sample workbook. Click on GO ADVANCED and use the paperclip icon to open the upload window.
    View Pic

    As for problems encountered:
    Macros names assigned to buttons have to be the same as macros names in a file (there is no StopClock macro, etc.)
    and most important: declarations have to be on the top of module code (see picture)
    Test attached file.
    Attached Images Attached Images
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    09-24-2015
    Location
    Portugal
    MS-Off Ver
    Mac
    Posts
    14

    Re: How to create an Stopwatch (chronometer) using two buttons.

    Thank you so much for your work and effort. It works perfectly

    Thanks so much.

  12. #12
    Registered User
    Join Date
    09-24-2015
    Location
    Portugal
    MS-Off Ver
    Mac
    Posts
    14

    Re: How to create an Stopwatch (chronometer) using two buttons.

    Sorry for asking for help again, but could you please help me in protectiong the file? I would like to maintain the save function but disable the save as... I've looking for some codes, however none worked with me...

  13. #13
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: How to create an Stopwatch (chronometer) using two buttons.

    I'd suggest - start another thread. Do you think that somebody using http://www.excelforum.com/search.php would go down the thread to post #12 to find answer? Aftrer reading first few will leave, because it's another subject. So frank advice - start new thread, with attachment, and following other tips from http://www.excelforum.com/forum-rule...rum-rules.html (may be also link to this thread.

  14. #14
    Registered User
    Join Date
    09-24-2015
    Location
    Portugal
    MS-Off Ver
    Mac
    Posts
    14

    Re: How to create an Stopwatch (chronometer) using two buttons.

    Ok . Thanks for the advice

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Create running stopwatch/timer with 1 button (start/stop). No reset button.
    By leeroy2612 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-26-2021, 12:59 AM
  2. [SOLVED] Can someone help me create a stopwatch?
    By dweinin357 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-02-2015, 02:22 AM
  3. how can i create buttons in Excel
    By medo82006 in forum Excel General
    Replies: 2
    Last Post: 06-05-2013, 06:06 AM
  4. create buttons in
    By nilsanp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-12-2011, 10:31 AM
  5. Create buttons
    By tvrm1963 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-24-2009, 07:13 PM
  6. To Create Hyperlink Buttons
    By tvrm1963 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-20-2009, 06:42 PM
  7. How to create buttons?
    By Mrrobinson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-19-2008, 03:45 PM
  8. Create buttons to sort
    By sbs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-02-2006, 04:16 AM

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