VBA Code to Close all Workbooks in One Go

VBA Code to close all workbooks all Workbooks in One Go

What is it:

This VBA Code will help you close all workbooks opened in the system in one go.


When you are creating an Excel Macro to create a consolidated report from multiple individual workbooks and after updating you want to close all the workbooks then this is the code will be a help.

How to close all workbooks in one go:

Step 1: Open the macro file or the excel where you want to put the code and press Alt + F11

vba code to close all workbooks

Step 2: Copy and Paste the below code in the VBA editor window and Save the workbook.

Sub closeWorkbook()

Dim wb As Workbook

For Each wb In Workbooks

    wb.Close SaveChanges:=True

Next wb

End Sub

About Anson

I’m Anson, having versatile experience in Business Process Outsourcing, Finance & Accounting, Information Technology, Operational Excellence & Business Intelligence. I'm currently working in a MNC in Bangalore, India. Learning anything new has always been my passions and if its related to Business and Technology then, I love it. This website/blog is an outcome of my passion towards it and I have been blogging since 2012. Outside business and technology I’m a movie freak who spends hours together watching and learning Cinema.

One Comment

  1. Pingback: Close All Workbooks in One Go using VBA Code | ...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.