Update Time Automatically

kumara_faith

Well-known Member
Joined
Aug 19, 2006
Messages
953
Office Version
  1. 365
Hi,

Is is possible to have Excel update time automatically in a given cell within the spreadheet.

I have a spreadsheet that I need Excel to update the time automatically .

I would like Excel to update the time automatically in cell A1.

I have done some research and found the following thread but this only works when we close and open the spreadsheet.

http://www.mrexcel.com/archive2/70800/82079.htm

Is there a way to have Excel update the time without having to close the spreadsheet ?

Thanks.
 
Vog II,

I tried that but the same thing happens.

Since I am new to VBA, let me again outline exactly how I have done this.

1) Click on cell C1 and format to hh:mm:ss
2) Alt F11
3) Insert > Module
4) Paste the following codes

Code:
Sub TickTock()
ThisWorkbook.Sheets("POI_Simulation_Test").Range("C1").Value = Now()
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "TickTock"
End Sub

Sub StopClock()
On Error Resume Next
Application.OnTime earliesttime:=NextTick, procedure:="TickTock", schedule:=False
On Error GoTo 0
End Sub

5) Right click on ThisWorkbook > View Code
6) Paste the following codes

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call StopClock
End Sub

Private Sub Workbook_Open()
Call TickTock
End Sub

7) Save and return to active sheet
8) Set macro to Low
9) Go to Tools > Macro > Macros, highlight StopClock and click Run.
9) Set macro to Low
10) Close workbook
11) Open workbook

However , when I close the workbook in step 11, the spreadsheet opens again.

Is there anything I am doing incorrectly ?

Thanks and appreciate all your patience.
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
What you have done seems correct to me. what is not working?

Incidentally, why do you need this? On my computer the time is shown in the Notification Area
 
Upvote 0

Forum statistics

Threads
1,224,532
Messages
6,179,388
Members
452,908
Latest member
MTDelphis

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