Results 1 to 3 of 3

2 Stop Timers on User Form

Threaded View

  1. #1
    Registered User
    Join Date
    09-22-2014
    Location
    India
    MS-Off Ver
    2003
    Posts
    7

    Unhappy 2 Stop Timers on User Form

    Hi All,

    I am trying to insert 2 stop timers on my VBA user form... One is to show login hours and other one to show break hours.
    My 1st timer is working well until I click a command button to activate 2nd timer to count break time. This command freeze 1st timer and now second timer doesn’t stop and behaves like 1st timer.
    I want to know if it’s possible to work two timers on same form. If yes how do I code that to insure one timer code does not interrupt the other one. I need timer one to be continuous and 2nd to start with last end time when started again.

    My current code goes as:

    Private Sub UserForm_Activate()
    Dim StopTimer As Boolean
    Dim Etime As Single
    Dim Etime0 As Single
    Dim LastEtime As Single
    
    StopTimer = False
    Etime0 = Timer() - LastEtime
    
    Do Until StopTimer
       Etime = Int((Timer() - Etime0) * 100) / 100
       If Etime > LastEtime Then
          LastEtime = Etime
          Label11.Caption = Format(Etime / 86400, "hh:mm:ss:") & Format(Etime * 100 Mod 100, "00")
          DoEvents
       End If
    Loop
    End Sub
    Last edited by JBeaucaire; 09-22-2014 at 01:45 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] User Form to execute search and return all values to the user form for editing
    By allwrighty in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2013, 10:40 PM
  2. [SOLVED] Excel vba user form- open directly to user form not worksheet
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 04-24-2013, 05:07 PM
  3. [SOLVED] Excel user form- If/Then statement outcome to show on user form
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2013, 09:16 AM
  4. Userform - stop user saving or closing form is not complete
    By denise6372 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2012, 12:24 AM
  5. calculating multiple stop/start timers within a cell
    By kmfdm515 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-24-2011, 02:20 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