Tip for easily deleting multiple Excel sheets at once
Tip for easily deleting multiple Excel sheets at once: Deleting sheets is a common task when working with Excel spreadsheets. If you need to delete a few sheets, you can do it manually. However, deleting dozens or even hundreds of sheets (to keep the spreadsheet tidy) can be a big problem if done the usual way. Please follow the article below to learn how to delete multiple Excel sheets at once.
1. Delete multiple Excel sheets at once by grouping sheets
Usually, to delete an Excel sheet, we just need to right-click on that sheet and select Delete.
If you want to delete multiple sheets at once, you just need to hold down the Ctrl key and select all the sheets you want to delete to group them into a group. Then right-click on any sheet and select Delete. That way, all the selected sheets will be quickly deleted.
Or if you want to delete all sheets in the file, you just need to group all sheets in the file into a group by right-clicking on any sheet and selecting Select All Sheets. Then right-click and select Delete as above to easily delete all sheets in the file.
2. Delete multiple sheets at once with VBA code
With this method, you can delete all sheets in your Excel file except for those named GPE. So you need to name GPE for the sheets you want to keep in your Excel file. Then, you select the Developer tab => Visual Basic or press the Alt + F11 shortcut to open Microsoft Visual Basic for Applications.
In the VBA window, select Insert => Module.
Then, copy the following code into the Module dialog box:
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
Then click Run or press F5 to run the code. That way, Excel sheets without the name GPE will be quickly deleted.
So, the article above has guided you on how to delete multiple Excel sheets at once. Hopefully, the article will be useful to you in your work. Good luck!