Forum Discussion
When is it advisable to quit and restart Excel?
The VBA command you provided, which is simply quitting Excel, is not directly available in Excel for Mac using VBA, so far I know. Unlike Windows, Excel for Mac does not support directly quitting the application through VBA code. However, you can achieve a similar result by closing all open workbooks. Here's how you can do it:
Vba code is untested, please backup your file first.
Sub QuitExcelOnMac()
Dim wb As Workbook
' Close all open workbooks except for the add-in workbooks
For Each wb In Application.Workbooks
If Not wb.IsAddin Then
wb.Close False
End If
Next wb
' Quit Excel (last workbook should be closed)
Application.Quit
End SubThis VBA code will close all open workbooks (excluding add-in workbooks) and then quit Excel. While it's not a direct "quit" command like in Windows, it achieves the same result by closing all workbooks and exiting the application. This approach should work effectively in Excel for Mac.
The text was created with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and like it!
This will help all forum participants.
- perkin_warbeckMar 10, 2024Brass Contributor
Thank you for sharing your code, but I wasn't looking for an automated solution. I'll simply advise Mac users to quit Excel at the end of the day, rather than just closing their workbooks. If you only close the workbooks, but Excel is still running, it continues to consume resources. I'm testing on a Mac Mini with only 16GB memory, so that may be why the overflows are only happening to me.