Excel Timer - To Run Independently

Pratap 1987

Board Regular
Joined
Feb 28, 2011
Messages
95
Hi Experts,

I have a basic timer macro – which captures the cycle time (or) current running time on the active cell (in Column L).
It works perfectly fine – when I stay on the active cell (in Column L).

However, when I move to a different row or to a different workbook – The timer stops.
Is there a way – to keep the timer running independently – despite being in a different workbook or sheet or row.

Below is the coding:

Sub Timer_click()
ay = ActiveCell.Row
With Worksheets("Sheet1").Cells(ay, 12)
.Font.Bold = Not .Font.Bold
End With
Update_Timer
End Sub

Sub Update_Timer()
ay = ActiveCell.Row
With Worksheets("Sheet1")
If .Cells(ay, 3) = Empty Or ay = 3 Or .Cells(ay, 12).Font.Bold Then Exit Sub
.Cells(ay, 12) = .Cells(ay, 12) + TimeValue("00:00:01")
End With
Timer_time
End Sub

Sub Timer_time()
Application.OnTime (Now + TimeValue("00:00:01")), "Update_Timer"
End Sub

Appreciate all your assistance with this 😊

With Love,
Pratap
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

ahazeman

New Member
Joined
Nov 14, 2020
Messages
2
Office Version
  1. 2007
Platform
  1. Windows
VBA Code:
Sub Timer_click()
ay = ActiveCell.Row
With Worksheets("Sheet1").Cells(ay, 12)
.Font.Bold = Not .Font.Bold
End With
Update_Timer
End Sub

Sub Update_Timer()
ay = ActiveCell.Row
With Worksheets("Sheet1")
If .Cells(ay, 3) = Empty Or ay = 3 Or .Cells(ay, 12).Font.Bold Then Exit Sub
.Cells(ay, 12) = .Cells(ay, 12) + TimeValue("00:00:01")
End With
Timer_time
End Sub

Sub Timer_time()
Application.OnTime (Now + TimeValue("00:00:01")), "Update_Timer"
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,127,601
Messages
5,625,749
Members
416,133
Latest member
ToseSenpai

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