I am using the below code to update an INTRO sheet that has current world times of a few places we to business.
I have two buttons, "Clock Update" and "Stop Clock".
Problem-when I protect the sheet and then press the Update Clock button I get a run time error of 1004. I gather this is telling me it can't run a macro using this button on a protected sheet?
Is there anyway around this??
I don't let the clock run all the time because it causes the screen to jump every time the clock updates ...<pre>Option Explicit
Dim NextTick
Sub ClockStart()
Run ("ClockUpdate")
End Sub
Sub ClockStop()
' Cancels the OnTime event (stops the clock)
Application.OnTime NextTick, "ClockUpdate", , False
End Sub
Sub ClockUpdate()
Application.ScreenUpdating = False
' Updates the clock that's visible
' DIGITAL CLOCK
ThisWorkbook.Sheets("fil-INTRO Sheet-4").Range("ESTDigitalClock").Value = CDbl(Time)
' Set up the next event one second from now
NextTick = Now + TimeValue("00:01:00")
Application.OnTime NextTick, "ClockUpdate"
Application.ScreenUpdating = True
End Sub</pre>
This message was edited by em on 2002-10-28 10:56
This message was edited by em on 2003-01-31 23:49
I have two buttons, "Clock Update" and "Stop Clock".
Problem-when I protect the sheet and then press the Update Clock button I get a run time error of 1004. I gather this is telling me it can't run a macro using this button on a protected sheet?
Is there anyway around this??
I don't let the clock run all the time because it causes the screen to jump every time the clock updates ...<pre>Option Explicit
Dim NextTick
Sub ClockStart()
Run ("ClockUpdate")
End Sub
Sub ClockStop()
' Cancels the OnTime event (stops the clock)
Application.OnTime NextTick, "ClockUpdate", , False
End Sub
Sub ClockUpdate()
Application.ScreenUpdating = False
' Updates the clock that's visible
' DIGITAL CLOCK
ThisWorkbook.Sheets("fil-INTRO Sheet-4").Range("ESTDigitalClock").Value = CDbl(Time)
' Set up the next event one second from now
NextTick = Now + TimeValue("00:01:00")
Application.OnTime NextTick, "ClockUpdate"
Application.ScreenUpdating = True
End Sub</pre>
This message was edited by em on 2002-10-28 10:56
This message was edited by em on 2003-01-31 23:49