Post your auto_close sub and explain the condition that must be met to cancel it.Is it possible to reset an 'Auto_Close' sub if a condition is met midway, so that the workbook stays open?
Sub Auto_Close()
OptimizeVBA True
'Delete:
Call DeleteSheets
With Cells: .Delete Shift:=xlUp: End With
'Call AutoBackup:
Call AutoBackup
OptimizeVBA False
'Save/Saved:
With Workbooks("CheckReportNumbers.xlsm"): .Save: .Saved = True: End With
End Sub
I don't see anything in what you posted that closes a workbook. And there are other modules involved that you are not showing. Keep in mind that we know nothing about what you want to accomplish or other code that may be involved.The if statement is in the 'AutoBackup' sub.Code:Sub Auto_Close() OptimizeVBA True 'Delete: Call DeleteSheets With Cells: .Delete Shift:=xlUp: End With 'Call AutoBackup: Call AutoBackup OptimizeVBA False 'Save/Saved: With Workbooks("CheckReportNumbers.xlsm"): .Save: .Saved = True: End With End Sub