How to quickly close all workbooks except active one?
If there are multiple workbooks opened in your computer, and now, you want to close all but leave the active one. Are there any quick ways for you to deal with this job except closing the other workbooks one by one? This article, I will talk about some easy ways for you to solve it with one click.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
With the following VBA code, you can quickly close all opened workbooks except the active one, please do as this:
1. Activate your workbook which you want to keep open.
2. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
3. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Close all workbooks except active one
Private Sub CloseOtherWorkbook() 'Update 20141126 Dim xWB As Workbook Application.ScreenUpdating = False For Each xWB In Application.Workbooks If Not (xWB Is Application.ActiveWorkbook) Then xWB.Close End If Next Application.ScreenUpdating = True End Sub
4. Then press F5 key to run this code, and then all the other workbooks have been closed at once, but leave only the active one.
If you are interested in a new product - Office Tab, it can help you to open multiple documents / files in a single tabbed window, with it, you can close all workbooks but leave active one with one click. You can know more and down load the Office Tab from here.
After installing Office Tab, you will see all the opened workbooks are displayed in one single tabbed window, see screenshot:
Then click the workbook name you want to leave opened, and right click the name tab, then choose Close Other from the context menu, see screenshot:
And then, you can see only your active workbook is opened.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 2 years agocan the macro be modified to close microsoft publisher files