I put this in the "Workbook":
![]()
Private Sub workbook_activate() alertTime = Now + TimeValue("00:00:10") 'delay for open indtil execute macro closingTime = Now + TimeValue("00:00:15") 'delay fra open til close Application.OnTime alertTime, "EventMacro" If TimeSerial(6, 0, 0) < Now And TimeSerial(8, 0, 0) > Now Then Application.OnTime closingTime, "CloseMacro" End If End Sub Private Sub EventMacro() Range("a500000").End(xlUp).Select End Sub Private Sub CloseMacro() With ThisWorkbook .Save .Close End With End Sub
-- But is says that "EventMacro" cannot run? Can anyone help me out?
Bookmarks