+ Reply to Thread
Results 1 to 2 of 2

Stopping a Timer / Running a timer simultaneously on Excel

  1. #1
    Paul23
    Guest

    Stopping a Timer / Running a timer simultaneously on Excel

    Private Sub cmdstartimer2_Click()
    startClock2
    End Sub
    Public Sub startClock2()

    Dim start
    Range("F7").Select
    start = Timer

    Do While stopped = False
    DoEvents
    Worksheets("Stopw").Range("F5").Value = Int((Timer - start + 0.5) / 60)
    Worksheets("Stopw").Range("H5").Value = (Timer - start) Mod 60
    Worksheets("Stopw").Range("I5").Value = (Timer - start + 0.5) - (Int(Timer -
    start + 0.5))
    Worksheets("Stopw").Range("D5").Value = Int((Timer - start + 0.5) / 3600)

    Loop

    End Sub

    I am using this VBA Code to start a timer process. I Can run more than one,
    but not simultaneously, and also I need a process to stop the timer. Can
    anyone help???
    Thanks (in advance)



  2. #2
    Tushar Mehta
    Guest

    Re: Stopping a Timer / Running a timer simultaneously on Excel

    Check out Chip Pearson's http://www.cpearson.com/excel/ontime.htm

    As far as running multiple routines goes, it is possible but I would not
    recommend it since XL/VBA are not designed with multi-threading in mind.

    --
    Regards,

    Tushar Mehta
    www.tushar-mehta.com
    Excel, PowerPoint, and VBA add-ins, tutorials
    Custom MS Office productivity solutions

    In article <DDB4ED3E-C5ED-4430-AEA0-DC90F808CF10@microsoft.com>, Paul23
    @discussions.microsoft.com says...
    > Private Sub cmdstartimer2_Click()
    > startClock2
    > End Sub
    > Public Sub startClock2()
    >
    > Dim start
    > Range("F7").Select
    > start = Timer
    >
    > Do While stopped = False
    > DoEvents
    > Worksheets("Stopw").Range("F5").Value = Int((Timer - start + 0.5) / 60)
    > Worksheets("Stopw").Range("H5").Value = (Timer - start) Mod 60
    > Worksheets("Stopw").Range("I5").Value = (Timer - start + 0.5) - (Int(Timer -
    > start + 0.5))
    > Worksheets("Stopw").Range("D5").Value = Int((Timer - start + 0.5) / 3600)
    >
    > Loop
    >
    > End Sub
    >
    > I am using this VBA Code to start a timer process. I Can run more than one,
    > but not simultaneously, and also I need a process to stop the timer. Can
    > anyone help???
    > Thanks (in advance)
    >
    >
    >


+ 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