Save and Close
On Thursday, June 21, 2018 at 12:37:04 PM UTC-4, Ilia Asafiev wrote:
On Thursday, June 21, 2018 at 10:49:17 AM UTC-4, Paul Doucette wrote:
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
I would add a check to see whether it is Read-only or not, otherwise you could get a runtime error.
Thanks!
|