Real Time Clock

rakupareek

New Member
Joined
Dec 29, 2023
Messages
34
Office Version
  1. 2016
Platform
  1. Windows
Hii
I am using following code for digital clock running real time
Sub clock()
Application.ScreenUpdating = False
Worksheets("Estimate").Range("J8").Value = Now
Application.OnTime Now + TimeValue("00:00:01"), "Clock"
Application.ScreenUpdating = True
End Sub

Private Sub Workbook_Open()
Worksheets("Estimate").Unprotect Password:="1234"
Call Clock
Worksheets("Estimate").Protect Password:="1234"
End Sub

Now my problem is:-
1. Screen flickering every second
2. When i unprotect sheet by putting password, The worksheet unprotect & protect automatically within second.
i can't edit in my worksheet.
please help me to resolve this.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Maybe if you explained the purpose of the idea someone can suggest an alternative approach. What you are doing makes no sense to me.
- Sheet opens, unprotects and then calls Clock
- Clock code runs in an instant and passes control back to the calling procedure
- Sheet gets protected. All of this probably happens in less than 1 second.
Not sure why you should expect anything else.
 
Upvote 0
I have inserted this clock in a invoice I want to print current time in invoice.
 
Upvote 0
Then I guess remove the protection and don't put it back on until some other point - perhaps when you close the file.
 
Upvote 0

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

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