Day(s)

:

Hour(s)

:

Minute(s)

:

Second(s)

7 Ways to Delete a Sheet in Microsoft Excel

Do you need to delete a sheet tab in your Excel workbook?

At some point in your career as an Excel user, you will need to delete a sheet from your workbook. Maybe it’s no longer needed, or maybe you made a mistake and need to start over.

In any case, deleting a sheet is a fairly straightforward process that can be accomplished in just a few simple steps.

This post will show you how to delete a sheet in Excel using several different methods.

Delete a Sheet with the Right Click Menu

The quickest and easiest way to delete a sheet is using the right-click menu.

You’ll be able to remove a sheet with a few easy clicks!

Here are the steps to delete any sheet in the workbook.

  1. Right-click on the sheet tab that you want to delete from the workbook.
  2. Select the Delete option from the menu.

Microsoft Excel will permanently delete this sheet. Do you want to continue?

Excel will show a popup warning that you are about to delete the sheet and that it can’t be recovered once it’s deleted.

  1. Click on the Delete button.

Your sheet will now be deleted from the workbook.

Delete Multiple Sheets

You might also want to delete multiple sheets at the same time rather than deleting each separately.

This is possible if you group the sheets together first.

Here are the steps to group together and delete multiple sheets.

  1. Left-click on the first sheet you want to delete.
  2. Hold the Ctrl key and left-click on any other sheets you also want to delete.

This will group the sheets together. You should see any grouped sheets are a lighter color to indicate they are grouped.

You will also see the Group term at the top of the workbook when a grouped sheet is active.

💡 Tip: You can also easily group adjacent sheets by clicking on the first sheet, holding the Shift key, and clicking on the last sheet. This will group together all the sheets in between.

  1. Right-click on any of the grouped sheets.
  2. Choose the Delete option.

This will also trigger the warning that you are about to permanently delete your sheets from the workbook.

  1. Click on the Delete button

All your selected sheets will be removed from the workbook.

📝 Note: You can’t delete all the sheets in the workbook. Your workbook must contain at least one visible sheet.

If you try to delete all the sheets, you will get a popup warning you A workbook must contain at least one visible sheet.

Delete a Sheet with the Home Tab

The most commonly performed commands will generally be found in the Home tab of the Excel ribbon.

Deleting a sheet is no exception and it is there as well in the Cells section.

Here are the steps to delete a sheet from the Home tab.

  1. Select the sheet you want to delete.

The command to delete sheets from the Home tab will delete the active sheet. So you’ll need to make sure the sheet that is currently displayed is the one you want to delete.

  1. Go to the Home tab.
  2. Click on Delete in the Cells section.
  3. Select Delete Sheet from the menu options.

The warning pop-up will appear and you can click on the Delete button to remove the sheet.

This will delete the sheet tab.

Delete a Sheet with the Navigation Pane

The navigation pane in Excel will list all the sheets and all the objects in those sheets. It allows you to quickly navigate to any of the content in your workbook with a click.

Not only does it list all the sheets, but it will also allow you to delete a sheet.

Follow these steps to delete a sheet from the Navigation pane.

  1. Go to the View tab.
  2. Click on the Navigation command in the Show section. This will show the navigation pane on the right side of the workbook.
  1. Right-click on the sheet name you want to delete.
  2. Select Delete from the menu options.

A warning will show in the navigation pane that you are about to delete the sheet.

  1. Press the Delete button.

Now your sheet is gone!

Delete a Sheet with a Keyboard Shortcut

Even though deleting a sheet is a very common task, there is no dedicated keyboard shortcut for this.

This might be so you don’t accidentally delete a sheet you didn’t mean to.

But if you want to delete a sheet using only your keyboard, it is still possible using the Alt hotkeys.

Press the Alt key to activate the hotkeys then press the following sequence of keys.

  1. Press H to select the Home tab.
  2. Press D to select the Delete command.
  3. Press S to select Delete Sheet from the Delete menu options.

This will delete the active sheet.

Delete a Sheet with the Legacy Keyboard Shortcut

Before the visual ribbon commands existed, Excel had a menu system. This came with its own set of accelerator keyboard shortcuts to access the various commands.

These shortcuts still work if you know them.

Press Alt + E + L to delete the current sheet with the legacy keyboard shortcut.

Delete a Sheet with VBA

Deleting sheets can be a tedious task when you need to delete many in your workbook. This is especially true because of the warning that will pop up after each deletion.

Grouping your sheets first can help to avoid multiple warnings, but you will still need to manually find and group all the sheets you want to delete.

You can use VBA to automate the process and also suppress the warning messages so you can avoid the extra clicks that come with this warning.

Go to the Developer tab and click on the Visual Basic command to open the VBA code editor.

Click on the Insert tab of the VBA editor and choose the Module option to create a new module to place your VBA code.

Depending on your desired outcome there are a few macro options you might want to implement.

Delete the Active Sheet with VBA

Sub DeleteActiveSheet()
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub

This macro will allow you to delete the active sheet in your workbook.

The Application.DisplayAlerts = False line of code will disable the warning messages so you won’t need to click on the Delete button in the popup before the sheet is deleted. This is set back to True after the sheet is deleted.

This is the most basic code for deleting a sheet.

Delete a Sheet By Name with VBA

Sub DeleteSheetName()
Application.DisplayAlerts = False
Sheets("Sheet1").Delete
Application.DisplayAlerts = True
End Sub

The above code will delete a sheet based on the tab name. In the above example, it will delete a sheet named Sheet1, but you can change the name used in this part of the code Sheets("Sheet1").Delete to suit your needs.

Delete All Sheets Except the Active Sheet with VBA

Sub DeleteAllSheets()
Application.DisplayAlerts = False
For Each ws In Worksheets
    If ws.name <> ActiveSheet.name Then
        ws.Delete
    End If
Next ws
Application.DisplayAlerts = True
End Sub

The above VBA code will loop through all the sheets in the workbook. If the sheet is not the active sheet, then the sheet will be deleted.

The Application.DisplayAlerts is set to False before the loop so that no warning will appear when each sheet is deleted.

When you run the code, all the sheets are deleted except the currently active sheet.

📝 Note: This VBA code uses the Worksheets object in the For Each loop. This won’t include any Macro sheets or Chart sheets. If you want to include these to be deleted, use the Sheets object instead.

Delete All Sheets that Contain Specific Text in the Name with VBA

Sub DeleteSheetsWithCertainText()
Dim MyText As String
MyText = Application.InputBox("Enter text that your sheets contain")
Application.DisplayAlerts = False
For Each ws In Worksheets
    If ws.name Like "*" & MyText & "*" Then
        ws.Delete
    End If
Next ws
Application.DisplayAlerts = True
End Sub

The above macro will delete all the sheets in the workbook that contain a certain text string in the sheet tab name. For example, you might use this to delete all the sheets in your workbook containing the text 2022 in order to prepare the template for the next year.

The code will show the user a popup with an input box that allows them to enter text. This text will be used as the criteria for deleting sheets in the workbook.

The code will loop through all the sheets and if the sheet name contains the user input text in the name, then the sheet will be deleted. This uses the asterisk * wildcard character and the Like comparative to test if the sheet name contains the text.

Delete a Sheet with Office Scripts

It’s also possible to automate deleting your sheets in Excel online by using Office Scripts.

When you delete a sheet programmatically in Office Scripts, there is no warning message that will appear so the code will not need to suppress this.

Go to the Automate tab and click on the New Script command to open the Office Scripts Code Editor.

The same scenarios can be achieved using Office Scripts as in the previous VBA examples.

Delete the Active Sheet with Office Scripts

function main(workbook: ExcelScript.Workbook) {
	// Delete active worksheet
	workbook.getActiveWorksheet().delete();
};

The above code will delete the active sheet in your workbook.

Delete a Sheet By Name with Office Scripts

function main(workbook: ExcelScript.Workbook) {
	// Delete worksheet by name
	workbook.getWorksheet("Sheet1").delete();
};

The above VBA code will delete the sheet named Sheet1 from your workbook.

Delete All Sheets Except the Active Sheet with Office Scripts

function main(workbook: ExcelScript.Workbook) {
	// get all worksheet objects into ws
	let ws = workbook.getWorksheets();
	let wsActName = workbook.getActiveWorksheet().getName();

	//loop through each sheet in ws
	//delete if not the active sheet
	for (let i = 0; i < ws.length; i++) {
		if (ws[i].getName() != wsActName) {
			ws[i].delete();
		};
	};
};

The above code will loop through all the sheets in the workbook and if the name is different from the name of the active sheet, then the sheet will be deleted.

Delete All Sheets that Contain Specific Text in the Name with Office Scripts

function main(workbook: ExcelScript.Workbook) {
	// get all worksheet objects into ws
	let ws = workbook.getWorksheets();
	let myText = "Sheet";

	//loop through each sheet in ws
	//delete if it contains myText in the name
	for (let i = 0; i < ws.length; i++) {
		if (ws[i].getName().includes(myText)) {
			ws[i].delete();
		};
	};
};

The above script will loop through all the sheets in the workbook and will delete the sheet if its name contains the text set in this let myText = "Sheet"; line of the code.

In this example, it will delete all the sheets which contain the text Sheet in their names, but you can adjust this based on your needs.

Conclusions

If you need to delete a sheet in Excel, several methods can be used depending on your needs.

You can delete a single sheet or multiple sheets from the right-click menu, Home tab, or with a keyboard shortcut. Additionally, the Navigation pane is a hidden place where you can also delete sheets.

For more complex situations such as deleting all sheets except for the active sheet, or deleting sheets that contain specific text in the name, you can use VBA or Office Scripts. These will also allow you to avoid the warning popups that occur during the manual methods.

Do you have any tips for deleting sheets in Excel? Share them with me in the comments below!

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and qualified actuary with over 15 years of experience. He has worked in a variety of industries, including insurance, ad tech, and most recently Power Platform consulting. He is a keen problem solver and has a passion for using technology to make businesses more efficient.

Subscribe

Subscribe for awesome Microsoft Excel videos 😃

John MacDougall

I’m John, and my goal is to help you Excel!

You’ll find a ton of awesome tips, tricks, tutorials, and templates here to help you save time and effort in your work.

Related Posts

Comments

0 Comments

Get the Latest Microsoft Excel Tips

Follow Us

Follow us to stay up to date with the latest in Microsoft Excel!

Subscribe for awesome Microsoft Excel videos 😃