+ Reply to Thread
Results 1 to 4 of 4

Excel VBA - Multiple procedures in 1 sheet to set up multiple timers

  1. #1
    Registered User
    Join Date
    10-26-2018
    Location
    Philadelphia
    MS-Off Ver
    2016
    Posts
    2

    Cool Excel VBA - Multiple procedures in 1 sheet to set up multiple timers

    Not a programmer, came across a site that has a stopwatch timer.

    Works great, i wanted to add multiple timers to about 6 rows, so i modified the procedure below. While at first it appears to work the problem is the next row that starts a timer will start where the row before it left off. How can i isolate each timer to be independent?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Excel VBA - Multiple procedures in 1 sheet to set up multiple timers

    .
    Here is an example project that you can draw from. This is only a portion of the code :

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,705

    Re: Excel VBA - Multiple procedures in 1 sheet to set up multiple timers

    These three variables are declared at the top of your module, which means they are global and shared by all procedures:
    Please Login or Register  to view this content.
    To fix your problem you need to declare a separate set of StopIt, ResetIt, and LastTime for each timer, instead of all the timers sharing the same variables.

    The code you grabbed is a somewhat unorthodox way of doing timers because each timer is in a continuous loop to determine if it's time to advance the timer to the next second. I did not test it but it seems like this would chew up a lot of CPU time. If it works for your purposes then I'll leave well enough alone.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Registered User
    Join Date
    10-26-2018
    Location
    Philadelphia
    MS-Off Ver
    2016
    Posts
    2

    Re: Excel VBA - Multiple procedures in 1 sheet to set up multiple timers

    makes sense, but when i add private and a new variable name for the next timer i get an error. appears you cannot add another declared variable after the first procedure? what would it take for you 6StringJazzer to write the code?

+ 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. multiple timers
    By kadlaw in forum Excel General
    Replies: 2
    Last Post: 11-14-2017, 04:56 AM
  2. Multiple timers
    By OillyBob55 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 08-17-2017, 04:38 PM
  3. [SOLVED] Multiple countdown timers and pop-up messages/alarms on a single sheet
    By charliethechamp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-21-2015, 06:21 AM
  4. Multiple Timers within EXcel
    By Janto724 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 04-26-2013, 09:07 AM
  5. multiple countdown timers in excel?
    By hollandrob81 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-06-2013, 04:12 PM
  6. Setup Multiple Timers
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2010, 04:38 PM
  7. Running multiple timers
    By tropy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-17-2006, 09:44 AM

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