VBA Code to Close all Workbooks in One Go

VBA Code to Close all Workbooks in One Go

Table of Contents

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.

Why:

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 WorkbooksPin

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

Anson Antony

Anson Antony

Anson is a contributing author and founder at ASKEYGEEK.com. Learning anything new has always been his passion, ASKEYGEEK.com is an outcome of his passion for technology and business. He has got a decade of versatile experience in Business Process Outsourcing, Finance & Accounting, Information Technology, Operational Excellence & Business Intelligence. During the tenure, he had worked for organizations like Genpact, Hewlett Packard, M*Modal and Capgemini in various roles and responsibilities. Outside business and technology, he is a movie buff who spends hours together watching and learning Cinema and a Film Maker too!

One Response

Leave a Reply

Your email address will not be published.

Launching soon...

E-book price at Amazon will be $14.99 

A Practical Guide To Online Business
Congratulations!
You Made It,
Don't Close!

Enter your chance to win our Premium Membership License for FREE! ( Normal Price $199/Year)

Thank you for your visit!

This popup won’t show up to you again!!!

Premium Membership Giveaway - Popup
small_c_popup.png

Let's have a chat

Fill out the form below to consult with us

*Please check your Inbox or Junk Folder for the Confirmation Email. You must confirm your Company email address before we could revert.

Share to...