Sub close() Do While ActiveWorkbook.Windows.Count > 1 ActiveWorkbook.Windows(myWorkbook.Windows.Count).Close Loop End Sub