Hi there,
I have the following macro in my Module that shows the real time clock
Option Explicit
Public g_dtNextTick As Date
Sub UpdateTimer()
With ThisWorkbook.Worksheets("Isotope Inventory")
.Cells(1, 1).Value = Date
.Cells(1, 2).Value = Time
End With
g_dtNextTick = Now + TimeSerial(0, 0, 1)
Application.OnTime g_dtNextTick, "UpdateTimer"
End Sub
I also have the following macro in the workbook to keep the clock running whenever the workbook is opened.
However, this prevents me from editing the workbook such as unlocking cells
I'd like to create a button to stop the macro of the clock, allowing me to unlock any cells for editing
Any advice would be great! Thanks
Option Explicit
Dim mblnOpenMode As Boolean
Private Sub Workbook_Activate()
If mblnOpenMode Then
mblnOpenMode = False
Me.Worksheets("Isotope Inventory").Cells(1, 1).NumberFormat = "dd-mm-yyyy"
Me.Worksheets("Isotope Inventory").Cells(1, 2).NumberFormat = "hh:mm:ss"
End If
Call UpdateTimer
End Sub
Private Sub Workbook_Deactivate()
On Error Resume Next
Application.OnTime g_dtNextTick, "UpdateTimer", Schedule:=False
On Error GoTo 0
End Sub
Private Sub Workbook_Open()
mblnOpenMode = True
End Sub
I also have the following
Bookmarks