Chris_yorks
New Member
- Joined
- Jan 1, 2024
- Messages
- 2
- Office Version
- 2003 or older
- Platform
- Windows
Hi,
I have a lovely workbook set up with a few, not so complicated macros for displaying a timer countdown. Various buttons for initialising, starting, stopping and changing tabs.
I can stop the timer quite easily by clicking on the stop button I created - This calls a macro stop_timer
I would like to call this macro when a certain cell has reached zero - I have that part working, however when I try to call this macro from another sub, I get an error "Runtime error 1004 Method 'OnTime' of object '_Application' failed
The final line of this sub, is highlighted in yellow when it fails :-
Sub stop_timer()
ActiveSheet.CommandButton3.Visible = False
ActiveSheet.CommandButton1.Visible = False
ActiveSheet.CommandButton2.Visible = True
ActiveSheet.CommandButton2.Activate
Application.OnTime EarliestTime:=interval, Procedure:="timer", Schedule:=False
End Sub
I was hoping that calling the sub would be the same as clicking on the button The button is CommandButton3.
Whether it is visible or activated or not, the same error occurs
For info, I have also tried calling a button click, to simulate the actual click which gives the same error.
Any help would be greatly appreciated.
Thanks for your time
I have a lovely workbook set up with a few, not so complicated macros for displaying a timer countdown. Various buttons for initialising, starting, stopping and changing tabs.
I can stop the timer quite easily by clicking on the stop button I created - This calls a macro stop_timer
I would like to call this macro when a certain cell has reached zero - I have that part working, however when I try to call this macro from another sub, I get an error "Runtime error 1004 Method 'OnTime' of object '_Application' failed
The final line of this sub, is highlighted in yellow when it fails :-
Sub stop_timer()
ActiveSheet.CommandButton3.Visible = False
ActiveSheet.CommandButton1.Visible = False
ActiveSheet.CommandButton2.Visible = True
ActiveSheet.CommandButton2.Activate
Application.OnTime EarliestTime:=interval, Procedure:="timer", Schedule:=False
End Sub
I was hoping that calling the sub would be the same as clicking on the button The button is CommandButton3.
Whether it is visible or activated or not, the same error occurs
For info, I have also tried calling a button click, to simulate the actual click which gives the same error.
Any help would be greatly appreciated.
Thanks for your time