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
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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
 
Upvote 0

Forum statistics

Threads
1,215,634
Messages
6,125,938
Members
449,275
Latest member
jacob_mcbride

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
Back
Top