How to Delete Chart in Excel? (Manual & VBA)

Charts are an excellent visualization tool, which is why we often end up having one too many in our worksheets.

Sometimes we might even end up having multiple copies of the same chart, thus requiring us to delete some of them.

This tutorial is going to be all about deleting charts (not creating them) for a change. We will look at how to delete charts in different cases

Manually Deleting a Single Chart in Excel

To delete a single chart from your sheet, simply click on the edge of the chart and press the Delete key on your keyboard.

Alternatively, you could select the chart, and navigate to Home-> Editing group-> Clear-> Clear All

Click on Clear All

Using the Navigation Pane (Microsoft 365 Only)

If you’re using Excel in Microsoft 365, you can use the Navigation option to see all the charts and objects you can in the workbook.

You can also easily select any chart you want to delete, and then hit the delete button.

Below are the steps to do this:

  1. Click the View tab
  2. In the Show group, click on Navigaton. This will open the Navigation pane on the right
Click on Navigation
  1. Click on the expand icon for the sheet that has the chart that you want to delete
Navigation Pane on the Right
  1. Right-click on the chart
Delete Chart option
  1. Click on Delete

The above steps would delete the selected chart.

If you only want to delete one single chart from the worksheet, this may look like a tedious method. in that case, you’re better off simply selecting the chart and deleting (as covered above).

The benefit of using navigation is that it shows you all the different sheets, charts, tables in one single pane. So if you want to delete multiple charts, or rename or hide them, then using this method would be useful.

Using VBA to Delete a Single Chart

If you have a lot of charts and prefer using VBA to individually select and delete charts, you can get this done with just a few lines of code.

If you prefer using VBA to delete individual charts, you can do so using the following code:

Sub DeleteSingleChart()
Dim chartName As Variant
chartName = InputBox(“Which chart would you like to delete”)
ActiveSheet.ChartObjects(chartName).Activate
If MsgBox(“Are you sure you want to delete this chart?”, vbYesNo, “Confirm Deletion”) = vbYes Then
ActiveChart.Parent.Delete
End If
End Sub

The above code will display an input box, letting you enter the name of the chart that you want to delete.

Once you enter the name of the chart, and confirm that you are sure you want to delete it, the code will delete the chart for you.

Tip: You will find the name of the chart to the left side of the formula bar when you select the chart.

Chart Name in the Name Box

To use the above code, follow the steps shown below:

  1. Navigate to Developer->Visual basic
Click on Visual Basic
  1. This opens your VBA window. Navigate to Insert->Module
Insert a new module
  1. Copy and paste the above code into the module window
Copy-paste the code in the module

Your macro is now ready to run.

To run this macro, return to your Excel window and follow the steps shown below:

  • Navigate to Developer->Macros
Click on Macros
  • This opens the Macro dialog box. Select the name of your module, which, in this case, is DeleteSingleChart.
Select the name of the Macro
  • Click Run
  • You should see an input box asking you to enter the name of the chart that you want to delete.
Input box opens up
  • Type in the name of the chart and press OK.
Enter the name of the chart you want to delete
  • You will then be asked to confirm if you’re sure you want to delete the chart.
Confirm if you want to delete the chart
  • Click Yes.

You will now find your specified chart deleted.

How to Delete only the Content from your Chart

If you want to simply delete some content from the chart, like a chart title or legend, then deleting the whole chart does not make much sense.

After all, why go through the entire process of rebuilding your chart from scratch right?

To remove any content from your chart, simply click on the content that you want to remove and again press the Delete key on your keyboard.

This will retain the rest of the chart and only get rid of the particular content that you selected.

How to Delete a Chart Sheet

Charts in Excel can either be embedded in a regular worksheet or they can be in their own chart sheets.

A chart sheet is a separate sheet in your workbook containing a chart.

The chart sheet looks similar to any other worksheet in your workbook and even has a separate tab for it at the bottom of your Excel window.

The only difference is that the chart sheet only contains a chart, and no cells and grids.

Chart Sheet

Deleting a chart sheet is similar to deleting any regular Excel sheet. All you need to do is right-click on the chart sheet’s tab and select ‘Delete’ from the context menu that appears.

Right Click and then delete

You will be asked to confirm that you want to permanently delete the chart sheet. Click the Delete button.

Confirm deleting the chartsheet

How to Delete all Charts in the Active Sheet

Let us now look at a case where you want to remove all the charts from a particular sheet. The solution for this is easy. Simply use the following code.:

Sub DeleteAllChartsOnSheet()
ActiveSheet.ChartObjects.Delete
End Sub

We already explained in this tutorial how to enter code into the Visual Basic window.

To run the code, navigate to Developer->Macros, and this time, select the macro named DeleteAllChartsOnSheet.

Run the macro to delete all charts

You will find all the charts on your active sheet deleted in one go.

Note that the deletions performed by your VBA code cannot be reversed. So, once you delete all the charts from a sheet, you will not be able to get them back.

To protect against accidental deletions, you can add a confirmation message box as part of your code, as follows:

Sub DeleteAllChartsOnSheet()
If MsgBox(“Are you sure you want to delete all charts in this sheet?”, vbYesNo, “Confirm Deletion”) = vbYes Then
ActiveSheet.ChartObjects.Delete
End If
End Sub

Now you will see a message box asking you whether you are sure you want to delete all these charts. 

Confirm deleting all charts in the active sheet

Once you confirm by clicking Yes, the macro will delete all charts in your sheet.

How to Delete all Charts in the Active Workbook

Let us now look at the final case, where you want to remove all charts from an entire workbook, not just a single worksheet.

For this you can use the following vba code:

Sub DeleteAllChartsInWorkbook()
Dim sh As Object
For Each sh In ActiveWorkbook.Sheets
sh.ChartObjects.Delete
Next
End Sub

The above code goes through each sheet in the active workbook and deletes all the charts in them.

Follow the same steps as shown in the previous section to insert and run the VBA code. Once you run the code, all charts in your current workbook will get deleted.

If you want to add a confirmation message box before deleting all the sheets, you can use the following version of the code instead:

Sub DeleteAllChartsInWorkbook()
Dim sh As Object
If MsgBox(“Are you sure you want to delete all charts in the workbook?”, vbYesNo, “Confirm Deletion”) = vbYes Then
For Each sh In ActiveWorkbook.Sheets
sh.ChartObjects.Delete
Next
End If
End Sub

Once you confirm by clicking yes, you should find all sheets in your active workbook removed.

In this tutorial, we showed you how to delete charts in different cases.

This includes cases where you want a single chart removed, multiple charts removed, or all charts removed. We hope you found the tutorial and our VBA code snippets useful.

Other articles you may also like: