dynamic clock

apgmin

Board Regular
Joined
Mar 1, 2010
Messages
150
Office Version
  1. 2013
Platform
  1. Windows
I am using the following clock as VBA It works fine, Can anyone help me and tell me how I can put it in other sheets also?

 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Dim SchedRecalc As Date

Sub Recalc()


With Sheet1.Range("A1")

.Value = Format(Time, "hh:mm:ss AM/PM")

End With

Call SetTime

End Sub

Sub SetTime()

SchedRecalc = Now + TimeValue("00:00:01")

Application.OnTime SchedRecalc, "Recalc"

End Sub

Sub Disable()

On Error Resume Next

Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False

End Sub


The line I highlighted in red is the part that does it. You could just change that. You can change the Sheet1 to the actual name of the sheet if you want, i.e. With Worksheets("Sheet1").Range("A1")
 
Upvote 0
Dim SchedRecalc As Date

Sub Recalc()

With Sheet1.Range("A1")

.Value = Format(Time, "hh:mm:ss AM/PM")

End With

Call SetTime

End Sub

Sub SetTime()

SchedRecalc = Now + TimeValue("00:00:01")

Application.OnTime SchedRecalc, "Recalc"

End Sub

Sub Disable()

On Error Resume Next

Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False

End Sub


The line I highlighted in red is the part that does it. You could just change that. You can change the Sheet1 to the actual name of the sheet if you want, i.e. With Worksheets("Sheet1").Range("A1")
I already did that. This way the clock comes on the sheet and cell you mention.
How do I get the clock on multiple sheets
 
Upvote 0
I would just reference that cell on the other sheets with a formula like this:
=Sheet1!A1
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

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