Hi,

Could you please give me some advice on how to properly use Application.EnableEvents and Application.ScreenUpdating?
The below dummy macro runs with no problems, but if a error is found I think it's not enabling EnableEvents and ScreenUpdating back, is it?
It will go to Exit sub and therefore ignore the previous code. Is it OK to have the TRUE lines between Exit Sub and End Sub?

Sub test1()
    
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    
'Check if trackers are available
On Error Resume Next
    Set DlT = Windows("Daily.xlsx")
    If Err.Number <> 0 Then
        MsgBox "Please open tracker"
        Exit Sub
    Else
    End If
    Set DlT = Windows("Flags.xlsx")
    If Err.Number <> 0 Then
        MsgBox "Please open flags"
        Exit Sub
    Else
    End If
    
    Application.EnableEvents = True
    Application.ScreenUpdating = True
    Exit Sub
End Sub
Thank you for your time!