VBA code that you can use to close all open workbooks at once in Excel.
VBA Code:
Sub CloseAllWorkbooks()
Dim wb As Workbook
' Loop through each open workbook
For Each wb In Application.Workbooks
' Close the workbook without saving changes
wb.Close SaveChanges:=False
Next wb
' Inform the user that all workbooks have been closed
MsgBox "All open workbooks have been closed!"
End Sub