if Event1_OT_Hour >23 then Event1_OT_Hour = 23
if Event1_OT_Hour <1 then Event1_OT_Hour = 0
can be replaced by if Event1_OT_Hour is a byte

Event1_OT_Hour=Event1_OT_Hour min 23
saves heaps of typing if nothing else