+ Reply to Thread
Results 1 to 7 of 7

running macros simultaneously

  1. #1
    Guest
    Join Date
    05-15-2009
    Location
    Paris, France
    MS-Off Ver
    Excel 2003
    Posts
    40

    running macros simultaneously

    Hi

    I am using Excel 2007 as part of my job. I am a strategist engineer in a race team.

    I have a worksheet to keep track of what is happening during the pit stops by my team and the closest car in the championship classification for each race.
    That bit is easy I simply tick boxes for what they do during the stops (driver change, tyres, fuel, ...)

    I want to add a timer for each of these cars to know how much time elapsed since the last pit stop.

    I created my own code for a timer (not perfect yet, so suggestions welcomed as well )
    But my problem is I cannot run my timers simultaneously.

    If one is running and I start another one, then it stops the first one.

    Any ideas on how I could allow up to 6 timers to run at the same time?

    Many thanks in advance.
    I have not included my code but I could if necessary

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: running macros simultaneously

    Good morning Astrid
    Quote Originally Posted by Astrid View Post
    Any ideas on how I could allow up to 6 timers to run at the same time?
    VBA doesn't allow macros to be run simultaneously, but that is not really required. All you need to do is know what time the race started and what time a particualr car finished and subtract one from the other.

    Something like the attached is a very simple example of how this might work - however due to the lack of informaton provided and without knowing what you have at the moment I can't take it any further :
    Please Login or Register  to view this content.
    Run the code "test" to start the timers going (log start time) then run stoptimers 1,2 and 3 to display the time in seconds.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Guest
    Join Date
    05-15-2009
    Location
    Paris, France
    MS-Off Ver
    Excel 2003
    Posts
    40

    Re: running macros simultaneously

    hello,

    thank you for getting back to me so quickly

    below is the code I have now for each timer:

    Please Login or Register  to view this content.
    P.S: The /540 is to get the time in seconds, otherwise it is sooo quick!! (I know it is not the perfect way and it is not yet a real second but I thought I'd have it running and then I would tune it

    I really need to be able to see live how long it has been for each car since the last pit stop. Just after the start of the race it is the same for all but then all the cars don't stop at the same moment. So I need to be able to start and stop each timer separately (my start and stop buttons for each)

    I will test your code but I feel it does not give me the time live does it?
    Last edited by Astrid; 05-15-2009 at 06:19 AM.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,440

    Re: running macros simultaneously

    Don't you just need to record, for each car, the following in order to be able to calculate lapsed times.

    Race Start (same for all cars)
    Pit stop 1 start
    Pit stop 1 stop
    Pit stop 2 start
    Pit stop 2 stop
    Pit stop 3 start
    Pit stop 3 stop
    Pit stop 4 start
    Pit stop 4 stop

    allowing enough pit stop records for a normal race.

    You code then does not need to run continuously. Instead it just stores current time, in the correct place of course.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Guest
    Join Date
    05-15-2009
    Location
    Paris, France
    MS-Off Ver
    Excel 2003
    Posts
    40

    Re: running macros simultaneously

    I am not sure I follow you.

    You are talking about the pit stops, so do you mean timing the stops and making the difference of the race length and the pit stop times?

    ok, let me explain with full details:

    the series I am running is the Le Mans Series. It is a 1000km race series. So there are 5 rounds working on the same principle.
    The first car to complete 1000 km wins. The maximum time available to do so is 6h. So depending on the circuit, the pace of the cars, the weather, the safety cars, ...... the length in time for the race changes. For example last weekend at Spa in Belgium our race lasted for about 5h45 but last year it was 5h17.

    so using the total length of the race is just not possible.

    Then what I need is the time in between pit stops, not the pit stop times. I may have planned in my strategy to stop every 27 laps for example but it always changes during the actual race. I could have a puncture and come in at lap 13 of a stint or it could happen to another car. Or we could stay long enough under safety car (cars much slower) to save enough fuel for another 2 laps or so and thus my stint becomes 29 laps long. And that's why I need to record the length live of each of the stints because if staying out to do more laps means the driver is going to stay for more than 3 hours straight in the car (or more than 4h in a 6h period) then I cannot stay out and I need to get my car in the pits to change driver.

    I don't know if I manage to make myself clear and explain everything very well but knowing the stint length is very very important.

    I wanted to use timers to be able to just see the clocks running. Apparently it is not possible so maybe, and I don't know if it is possible to do, I could have just one clock (or the computer one) and when I press a start button for a car it records what time it is and then when I press another button it displays the time elapsed since the first button was pushed but without erasing the clock.
    The clock could be put back to zero when details for a pit stop are entered in the spreadsheet.

    But then is it possible to do that simultaneously for 6 cars? and how?
    ...

    Thank you in advance for your help and thank you to Andy Pope and dominicb for answering already

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,440

    Re: running macros simultaneously

    See attached.

    What you would do is record the time any significant event occurred during the race. With this information you can the calculate duration, time remaining.

    You would need code in order to make the recorded time appear in the correct location.
    Attached Files Attached Files

  7. #7
    Guest
    Join Date
    05-15-2009
    Location
    Paris, France
    MS-Off Ver
    Excel 2003
    Posts
    40

    Re: running macros simultaneously

    Hi Andy,

    thanks for the excel workbook and sorry for the delay in getting back to you.

    I have tried what you said, I was going to write a reply saying it worked but not completely but I have just found my mistake so I think it all works now. If not I'll be back soon

    Thank you!!

+ 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