If you find yourself manually deleting numerous sheets in an Excel file, it can be time-consuming. In this article, Mytour shares a tip to quickly delete multiple sheets in Excel.
1. Standard Method for Deleting Multiple Sheets in Excel
To delete sheets in Excel using the standard method, right-click on the sheet name in the tab bar, and choose Delete.
To delete multiple sheets simultaneously, you need to select them all at once.
Hold down the Ctrl key and click on the sheets you want to delete one by one.
After selecting the sheets, right-click on them and choose Delete from the displayed menu.
If you need to delete many sheets and keep only a few, right-click on any sheet, and choose Select All Sheets. Then, click on the sheets you want to keep instead of deleting.
Hold down the Ctrl key and click on the sheets you want to keep instead of deleting.
Next, right-click on the sheets you want to delete and choose Delete from the displayed options.
2. Deleting Multiple Sheets Using Macros
In addition to direct sheet deletion, you can utilize Macros to delete multiple sheets at once.
With this method, you can delete all sheets in your Excel file except those named GPE. Therefore, name the sheets you want to keep as GPE in your Excel file.
Afterward, press the Alt F11 key combination to open Microsoft Visual Basic for Applications.
Next, click on the Insert tab in the options list and choose Module from the displayed list.
Then, copy the code below and paste it into the code editing frame:
Public Sub GPE()
Application.DisplayAlerts = False
Dim Ws As Worksheet
For Each Ws In Worksheets
If Ws.Name <> 'GPE' Then Ws.Delete
Next Ws
Application.DisplayAlerts = True
End Sub
Proceed by clicking the Run tab on the horizontal toolbar. Alternatively, you can swiftly press the F5 key.
Select Run to execute the program and efficiently delete multiple sheets at once.
As a result, you will observe that sheets, excluding the one named GPE, get rapidly removed.
If you notice the sheet named GPE in the code snippet, and you wish to avoid keeping a sheet with the name GPE, feel free to change it to any other name of your choice.
This tutorial on swiftly deleting multiple sheets in Excel from Mytour concludes here. We hope that through this article, you can learn effective ways to quickly remove multiple sheets in Excel. Best of luck with successfully implementing this trick.