+ Reply to Thread
Results 1 to 4 of 4

Click Button to start/stop a Stop Watch

Hybrid View

Aeneren Click Button to start/stop a... 01-13-2016, 09:44 PM
Aeneren Re: Click Button to... 01-13-2016, 10:12 PM
chin67326 Re: Click Button to... 01-13-2016, 10:20 PM
Aeneren Re: Click Button to... 01-14-2016, 01:25 PM
  1. #1
    Registered User
    Join Date
    04-08-2012
    Location
    Kansas, U.S
    MS-Off Ver
    Excel 2010
    Posts
    93

    Click Button to start/stop a Stop Watch

    Hello,

    Trying to figure out a way to click on a ActiveX CommandButton or a Form Control Button to Start a Stop Watch and have the time start in a specific Cell say D2, this needs to be done on 15 - 20 Lines. So there will be a Click button in C2:C20 that need to start stopwatches in D2:D20, Also if a timer is running, will re-clicking the start button start the timer over again or will a reset be needed. Any help be greatly appreciated.


    Aeneren

  2. #2
    Registered User
    Join Date
    04-08-2012
    Location
    Kansas, U.S
    MS-Off Ver
    Excel 2010
    Posts
    93

    Re: Click Button to start/stop a Stop Watch

    Hello again,

    Afterposting my Question found this Code in a thread here and it works as written, now can anyone tell me how to use this same bit of Code on same worksheet say another 19 lines.

    'Written: February 01, 2011
    'Author:  Leith Ross
    
    Private TimerCell As Range
    Private TimerEnabled As Boolean
    Private TimerValue As Double
    
    Sub SetTimerCell()
        Set TimerCell = Worksheets("Sheet1").Range("D2")
        TimerCell.NumberFormat = "@"
    End Sub
    
    Sub StartTimer()
      If TimerEnabled Then Exit Sub
      If TimerCell Is Nothing Then SetTimerCell
      TimerEnabled = True
      ShowTime
    End Sub
    
    Sub StopTimer()
      TimerEnabled = False
    End Sub
    
    Sub ResetTimer()
      TimerEnabled = False
      If TimerCell Is Nothing Then SetTimerCell
      TimerValue = 0
      TimerCell = "00:00.0"
    End Sub
    
    Sub ShowTime()
      
      Dim Delay As Single
      Dim Mins As Integer
      Dim Secs As Variant
      Dim StartTime As Single
      
        Delay = 0.1
        StartTime = Timer
        
          Do While TimerEnabled
            While Timer < StartTime + Delay: Wend
            TimerValue = TimerValue + 0.1
              Mins = Int(TimerValue) \ 60
              Secs = TimerValue - (Mins * 60)
            TimerCell.Value = Format(Mins, "00") & ":" & Format(Secs, "00.0")
            StartTime = Timer
            DoEvents
          Loop
        
    End Sub
    I have gone in on same worksheet made a Module2 copied the code into it made new Click buttons assianed them to the code in Module2 and it is working but can only have 1 timer running at a time, so is there a way to have multiple timers running at same time ??


    Aeneren
    Last edited by Aeneren; 01-13-2016 at 11:36 PM.

  3. #3
    Forum Contributor
    Join Date
    06-07-2014
    Posts
    218

    Re: Click Button to start/stop a Stop Watch

    Paging Leith Ross...

  4. #4
    Registered User
    Join Date
    04-08-2012
    Location
    Kansas, U.S
    MS-Off Ver
    Excel 2010
    Posts
    93

    Re: Click Button to start/stop a Stop Watch

    Bump . . .

    Any one have any pertinent helpful suggestions.

    Aeneren

+ 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. Can not run the macro - Start Stop Time button
    By tangerine7199 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-22-2014, 02:41 PM
  3. Start/Stop button help Timer auto update
    By Tortus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-30-2014, 11:16 AM
  4. to update stop watch in excel with start/pause and reset options.
    By harry_appu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-25-2013, 01:42 PM
  5. Stop Watch
    By Mr.India in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2013, 11:02 AM
  6. Toggle Button to Start/Stop Scrollbar Progression
    By JP777 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2012, 12:46 AM
  7. Start/Stop Macro Button
    By Paul987 in forum Excel General
    Replies: 1
    Last Post: 07-10-2006, 12:19 PM

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