I haven't looked closely at your code but I think you should be looking at cancelling the last .Ontime you've scheduled as soon as you press the OK or X on the userform.
You can cancel/clear a previously scheduled .Ontime if:
(a) the current time is still before the Earliest argument of .Ontime
(b) you know the exact time it was scheduled for
(c) you know the macro name that was to be called
For (b), this means that each time you create a .Ontime schedule you make a note of the exact time it's scheduled for (you could use a global variable to hold that time, set the global variable first, call the .Ontime schedule using that global variable)
For (c) I'm guessing you only call one macro so you may not have to use a variable to store that.
For (a) if the Earliest time has lapsed it probably doesn't matter any more!
The way to cancel an existing .Ontime schedule is to call the scheduling again with the same time and macro name but add the 4th argument of False to the line (it's the argument named Schedule. See https://docs.microsoft.com/en-us/off...ication.OnTime
So when you set a schedule as you do with:
Application.OnTime Now + TimeValue("00:00:01"), "next_moment"
intead use maybe:
NextMomentTime = Now + TimeValue("00:00:01")
Application.OnTime NextMomentTime, "next_moment"
where NextMomentTime is a global variable holding the time, so when you want to clear the schedule on closing the userform, include the code:
Application.OnTime NextMomentTime, "next_moment", False
to clear that schedule.