Delete all charts in excel

Excel for Microsoft 365 Excel 2021 Excel 2019 Excel 2016 Excel 2013 More…Less

Sometimes you need to remove a chart or graph to unclutter the space of your spreadsheet or make the rest of the information stand out.

When you delete a chart, the data you have used as the source of the table remains intact.

  1. Click the edge of chart’s frame to highlight the chart.

    The chart is highlighted.

  2. On the Home tab, in the Editing group, click Clear > Clear All.

    You can find Clear All from the Clear menu.

    Tip: For faster results, you can also press Delete on your keyboard.

Delete content from a chart

You don’t have to recreate your chart if you want to remove some information from it, such as a column or line.

  1. Click the object you want to remove from the chart.

    Handlebars surround the blue bars that have been selected.

  2. Press Delete on your keyboard.

    The rest of the chart remains intact.

    The chart now has two instead of three items.

Related Topics

Create a chart from start to finish

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Содержание

  • Способ 1: Горячая клавиша
  • Способ 2: Инструмент «Вырезать»
  • Способ 3: Функция «Очистить»
  • Способ 4: Удаление содержимого диаграммы
  • Вопросы и ответы

Как удалить диаграмму в Excel

Способ 1: Горячая клавиша

Начать предлагаем с самого простого доступного метода, подразумевающего использование горячей клавиши Del (Delete) для быстрого удаления всего содержимого диаграммы любого типа в Excel. Вам понадобится только выделить сам график, чтобы по его краям появились точки для редактирования, а затем нажать по этой клавише и посмотреть, как объект будет удален из таблицы.
Использование горячей клавиши для быстрого удаления диаграммы в Excel

Если вы несколько раз нажмете эту клавишу, возможно, затронутся и другие объекты таблицы, поэтому будьте осторожны и не забывайте, что есть другое вспомогательное сочетание клавиш Ctrl + Z, отменяющее последнее действие.

Способ 2: Инструмент «Вырезать»

В Экселе есть инструмент под названием «Вырезать», по названию которого сразу же можно понять, что он предназначен для удаления ненужных объектов. Вызывается он двумя разными методами, а весь процесс очистки таблицы от графика выглядит так:

  1. Выделите диаграмму и нажмите по любому пустому месту правой кнопкой мыши для вызова контекстного меню.
  2. Выделение диаграммы для ее удаления через инструмент Вырезать

  3. Выберите первый же пункт «Вырезать».
  4. Выбор инструмента Вырезать через контекстное меню для удаления диаграммы в Excel

  5. Все содержимое сразу же будет очищено.
  6. Успешное удаление диаграммы в Excel через инструмент Вырезать в контекстном меню

  7. Дополнительно можно воспользоваться блоком «Буфер обмена» на вкладке «Главная», где находится значок с изображением ножниц, что тоже вызывает срабатывание инструмента «Вырезать», только не забудьте перед этим обязательно выделить график.
  8. Выбор инструмента Вырезать для удаления диаграммы в Excel через блок Буфер обмена

Способ 3: Функция «Очистить»

Примерно по такому же принципу работает функция «Очистить», но ее потенциальные возможности более шире. В нашем же случае для очистки всей диаграммы понадобится применить только одно ее действие.

  1. Выделите диаграмму и через вкладку «Главная» откройте блок «Редактирование».
  2. Переход в раздел Редактирование для работы с функцией Очистить при удалении диаграммы в Excel

  3. Разверните выпадающее меню «Очистить».
  4. Выбор функции Очистить для удаления диаграммы в таблице Excel

  5. Щелкните по первому же пункту «Очистить все».
  6. Использование функции Очистить все для быстрого удаления диаграммы в таблице Excel

  7. Вернитесь к таблице и убедитесь в том, что график там больше не отображается.
  8. Успешное удаление диаграммы в таблице Excel при помощи функции Очистить

Более детально ознакомьтесь с функциональностью инструмента «Очистить», если в будущем желаете удобно удалять содержимое таблицы, форматы и другие элементы.

Способ 4: Удаление содержимого диаграммы

Иногда юзеру требуется не полностью удалить график, а только конкретное его содержимое, например название, оси или один из диапазонов данных. В таком случае принцип действий не сильно меняется и сама процедура не становится сложнее.

  1. После перехода к работе с графиком выделите необходимый элемент, чтобы по краям появилась рамка редактирования. Используйте клавишу Del для быстрого удаления.
  2. Выбор элемента диаграммы для удаления содержимого в Excel

  3. Содержимое сразу же будет очищено, что можно увидеть на следующем изображении.
  4. Успешное удаление содержимого диаграммы при помощи горячей клавиши в Excel

    Lumpics.ru

  5. Альтернативный вариант — сделать по элементу правый клик мышкой и в контекстном меню выбрать пункт «Удалить». Это приводит точно к такому же результату.
  6. Использование контекстного меню и функции Удалить для очистки содержимого диаграммы в Excel

Если потребность в удалении диаграммы или ее содержимого вызвана изначально неправильным подходом к созданию этого элемента, советуем прочитать другую инструкцию на нашем сайте, которая поможет разобраться в правильном использовании разных типов графиков в Excel.

Читайте также: Диаграммы в Microsoft Excel

Еще статьи по данной теме:

Помогла ли Вам статья?

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:

  • How to Delete a Sheet in Excel Using VBA
  • How to Delete a Comment in Excel (or Delete ALL Comments)
  • How to Insert Chart Title in Excel? 2 Easy Ways
  • How to Move a Chart to a New Sheet in Excel
  • How to Create Org Chart in Excel? Easy Method
  • How to Delete a Pivot Table? 4 Different Ways!
  • Save Excel Chart as Image (High Resolution)

How to delete all charts in Excel Workbooks using VBA.

ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.Parent.Delete

asked Jan 5, 2016 at 5:28

Ashwith Ullal's user avatar

This should take care of your needs. It prompts the user also, via MsgBox as a precaution against deleting wanted charts/objects.

Sub delAllChartsInWorkbook()
'
' delchart Macro
' Macro recorded 1/4/2016 by ejbytes
'
    'Variables
    Dim count As Integer
    Dim LIST As Integer
    Dim currSheet As Worksheet
    Dim myChart As ChartObject
    Dim YesOrNoAnswerToMessageBox As String
    Dim QuestionToMessageBox As String
    Dim tmpName As String


    'Define Variables
    count = ActiveWorkbook.Worksheets.count

    '****************************************************
    'Loop example using a count.                        *
    '****************************************************
    For LIST = 1 To count
        MsgBox "This is a loop example. This is Sheet: " _
                 & ActiveWorkbook.Worksheets(LIST).Name
    Next LIST



    '****************************************************
    '* Loop example all sheet in this workbook          *
    '* Cycle through each Sheet                         *
    '* Nested Loops:                                    *
    '*                                                  *
    '* Outer Loop                                       *
    '****************************************************
    For Each currSheet In Worksheets
        MsgBox "Current sheet: " & currSheet.Name

        '****************************************************
        '* Cycle through each Chart Object on current sheet *
        '* Sheets("Sheet1").ChartObjects                    *
        '*                                                  *
        '* Inner Loop                                       *
        '****************************************************
        For Each myChart In currSheet.ChartObjects

            QuestionToMessageBox = "DELETE chart: '" & myChart.Name & "' ?"
            YesOrNoAnswerToMessageBox = _
                MsgBox(QuestionToMessageBox, vbYesNo, "Yes/No Comment?")

            If YesOrNoAnswerToMessageBox = vbNo Then
                MsgBox "Chart: " & myChart.Name & " skipped."
            Else
                tmpName = myChart.Name
                myChart.Delete
                MsgBox "Chart: " & tmpName & " Deleted!"
                'Modify my chart? You can do this too:
                'myChart.Chart.ChartType = xlLine
            End If
        Next myChart
    Next

End Sub

answered Jan 5, 2016 at 6:50

ejbytes's user avatar

ejbytesejbytes

1,9803 gold badges13 silver badges24 bronze badges

To delete all charts on the active sheet:

Sub DeleteChartsOnActiveSheet()
  ActiveSheet.ChartObjects.Delete
End Sub

To delete all charts on all sheets in the active workbook:

Sub DeleteChartsInActiveWorkbook()
  ' delete chart sheets
  ActiveWorkbook.Charts.Delete

  ' delete charts embedded in other sheets
  Dim sh As Object
  For Each sh in ActiveWorkbook.Sheets
    sh.ChartObjects.Delete
  Next
End Sub

answered Jan 11, 2016 at 20:46

Jon Peltier's user avatar

Jon PeltierJon Peltier

4,32222 silver badges25 bronze badges

Sub DeleteChartsInThisWorkbook()

Dim Msg As String  
Dim cws As Chart  
Dim cobj As ChartObject  
Dim wb As Workbook  
Dim ws As Worksheet

1    On Error GoTo ErrorHandler  
'    Delete chart sheets  
2    Set wb = ThisWorkbook  
3    For Each cws In wb.Charts  
4      Application.DisplayAlerts = False  
5      cws.Delete  
6      Application.DisplayAlerts = True  
7    Next cws  

'    Delete charts embedded in all other worksheets  
8    For Each ws In wb.Sheets  
9      For Each cobj In ws.ChartObjects  
10       cobj.Delete  
11     Next cobj  
12   Next ws  

13   Exit Sub  
ErrorHandler:  
14   If Err.Number <> 0 Then  
15      Msg = "Error # " & str(Err.Number) & " was generated by " & chr(13) _  
            & "Sub DeleteChartsInThisWorkbook() on Sheet#(Name)" & chr(13) _  
            & "Error Line: " & Erl & chr(13) _  
            & Err.Description  
16       MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext  
17   End If  
End Sub  

answered Aug 29, 2020 at 23:14

Norbert Metternich's user avatar

2


You can use the following methods in VBA to delete charts in Excel:

Method 1: Delete All Charts on Active Sheet

Sub DeleteActiveSheetCharts()
ActiveSheet.ChartObjects.Delete
End Sub

This particular macro will delete all charts from the currently active sheet in Excel.

Method 2: Delete All Charts in Entire Workbook

Sub DeleteAllWorkbookCharts()

Dim wk As Worksheet

For Each wk In Worksheets

    If wk.ChartObjects.Count > 0 Then
        wk.ChartObjects.Delete
    End If
    
Next wk

End Sub

This particular macro will delete all charts from every sheet in the entire Excel workbook.

The following examples show how to use each method in practice.

Example 1: Delete All Charts on Active Sheet

Suppose we have the following sheet in Excel that contains two charts:

We can create the following macro to delete all of the charts from this sheet:

Sub DeleteActiveSheetCharts()
ActiveSheet.ChartObjects.Delete
End Sub

When we run this macro, we receive the following output:

Notice that both charts have been deleted from the sheet.

Example 2: Delete All Charts in Entire Workbook

Suppose we have another sheet in our Excel workbook that contains two more charts:

We can create the following macro to delete all charts from both sheets in the workbook:

Sub DeleteAllWorkbookCharts()

Dim wk As Worksheet

For Each wk In Worksheets

    If wk.ChartObjects.Count > 0 Then
        wk.ChartObjects.Delete
    End If
    
Next wk

End Sub

Once we run this macro, all charts from both sheets will be deleted:

Note that in this example we only deleted charts from two sheets but this macro will work with an Excel workbook with any number of sheets.

Additional Resources

The following tutorials explain how to perform other common tasks in VBA:

VBA: How to Delete Rows Based on Cell Value
VBA: How to Delete Sheet if Name Contains Specific Text
VBA: How to Delete Files

Like this post? Please share to your friends:
  • Degrees of comparison for the word little
  • Degree of comparison of the word little
  • Degree of comparison for word bad
  • Defintions of a word
  • Definitions of word types of meaning