Hello! Help to understand what the problem is or tell me how to implement it correctly. It is necessary to display messages after the passage of a certain time from the specified in the cell.

For example: enter 11:30 in cell A1, after 30 minutes from the specified time (ie at 12) messages appear, after an hour from the specified time (12:30) another message, etc.

In programming for Excel and VBA is not strong, but I was able to build such a primitive macro, which is the output of the message, though it appears every time 2 times, but I can not understand how to make the message appear only 1 time.

Sub Напоминание() ' Сочетание для запуска: Ctrl+Shift+A timeStart = TimeValue(Format(Range("A1"), "h:m:s")) firstAlarm = timeStart + CDate("00:30:00") secondAlarm = timeStart + CDate("01:00:00") Application.OnTime firstAlarm, "Alarm" Application.OnTime secondAlarm, "secAlarm" End Sub Sub Alarm() MsgBox "Сообщение 1" End Sub Sub secAlarm() MsgBox "Сообщение 2" End Sub 

    1 answer 1

    Something I can not understand. Behavior description is only in the example:

    For example: enter 11:30 in cell A1, after 30 minutes from the specified time (ie at 12) messages appear, after an hour from the specified time (12:30) another message, etc.

    And for him, the reminder procedure must be performed 2 times. Further, you, in the above listing have achieved this, but do not like the fact that the reminder is performed 2 times. So what do you want?

    If the second reminder should work only in some (not yet clear) situations, handle these situations and set / remove the necessary / unnecessary timer.

    For example, if the second reminder should work only if the first one is canceled, then output the dialogue in the first one, according to the user's reaction to which it will be possible to follow the conclusion whether the second timer is needed. At this point, or cancel the previously established second timer, the benefit is, the functionality is in the same Application.OnTime . Or, on the contrary, initially set only one timer, and according to the user's reaction to the first one, if necessary, start the second timer. Wash, the second option is preferable.