Hi,
I created excel sheet with timer trigger, so the sheet will protected after timer reach 00:00. The timer is work and excel is protected after timer reach 00:00 but my issue if i put cursor in edit mode, the timer stop moved and my excel become protected before it reach 0 (since actual timer already pass 0)
Capture.JPG
How to solve this issues, this is my VBA Code
in Module 1
Sub timer()
interval = Now + TimeValue("00:00:01")
If Range("B1").Value = 0 Then Exit Sub
Range("B1") = Range("B1") - TimeValue("00:00:01")
Application.OnTime interval, "timer"
End Sub
in Module 2
Sub Protectsheets()
Sheets("Sheet1").Protect Password:="Password"
End Sub
Then i call this 2 module when excel started/open, in this workbook
Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:00:35"), "Protectsheets"
Application.OnTime Now, "timer"
End Sub
Can you help where i make my mistakes ?
Thanks.
Rio
Bookmarks