Thread: Save and Close
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Paul Doucette Paul Doucette is offline
external usenet poster
 
Posts: 40
Default Save and Close

On Wednesday, June 20, 2018 at 4:12:53 PM UTC-4, Paul Doucette wrote:
Is there code I can put into a my personal workbook which would allow me to save and close all of open workbooks? I have several that are quite large and often end up with a dozen open at the end of the day, so it would be a time saver.
Thanks!


Thanks Claus!

Sub CloseAndSave()
Dim wbk As Workbook

Application.ScreenUpdating = False
For Each wbk In Workbooks
If wbk.Name < ThisWorkbook.Name Then
wbk.Close True
End If
Next
Application.ScreenUpdating = True
Application.Quit
End Sub