Timers in excel

David S

New Member
Joined
Apr 19, 2013
Messages
2
Hi all. Hope you can help. I have never been trained on VBA and am trying to create a countdown timer. I have acheived that however the timer is needed on 15 different tabs, which represent 15 different trials and therefore needs to be specific to that tab.

At the moment if I am on any particular test the timer works fine, however if I move off that tab the timer stops on the original tab and starts on the current tab. I need to be able to move about tabs with the active test timer still running and the non active test timers static. The timer is a countdown with the start time dictated by a "sample time" column as the sample time may be changed during the trial. So I have used if statements to look up the column from the bottom to determine the sample time for that particular phase of the trial. The code I currently have in Module 1 is

Sub Countup()
Dim CountDown As Date
CountDown = Now + TimeValue("00:00:01")
Application.OnTime CountDown, "Realcount"
End Sub

Sub Realcount()
Dim count As Range
Set count = [t13]
count.Value = count.Value - TimeSerial(0, 0, 1)
If count <= 0 Then
Beep
MsgBox "WEIGH THE TRAY"
Exit Sub
End If
Call Countup
End Sub


I also have a timer override in the timer, so that if we have to stop part way through a specific time period I can overwrite to allow for remaining time, and then I can reset that to look back at the sample time column for the next phase of the trial
Is there any way to have this code specific to a particular sheet, e.g. Test 1, Test 2 etc


I tried to insert an image to show what the timer buttons look like in the sheet, but am not sure how to do that on here.

I also realise that I could just download a timer app, but you know how it is, you get into something like this and are close to the end result and cannot let it beat you :)

Thanks

David
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

northwolves

Well-known Member
Joined
Jun 21, 2006
Messages
1,128
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2010
  6. 2007
  7. 2003 or older
Platform
  1. Windows
Search Google for usage of API "Sleep"
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,147
Messages
5,835,669
Members
430,373
Latest member
swartzfeger

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top