|
Delete All Chart Sheets in Excel - Only Chart Sheets are Deleted - Not Embedded Charts
Delete all chart sheets and tabs in Excel using this macro. This will only delete the charts and graphs that are in their own tab or worksheet. No embedded charts will be deleted using this macro. Also, when you run this macro, a warning message will pop up to verify that you want to delete the worksheets or tabs.
To use this macro just install it and run it. It works on the active workbook in Excel. If you don't have a chart sheet or tab in Excel, this macro will throw an error. This is easy to fix, but in the interest of providing the simplest version of this macro so that you can more easily integrate it into your own vba code, those features were not included.
Where to install the macro: Module
Excel Macro to Delete All Chart Sheets in Excel - Only Chart Sheets are Deleted - Not Embedded Charts
Sub delete_all_chart_sheets_in_workbook()
'This example deletes every chart sheet in the active workbook.
ActiveWorkbook.Charts.Delete
End Sub
How to Install the Macro
- Select and copy the text from within the grey box above.
- Open the Microsoft Excel file in which you would like the Macro to function.
- Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.
Or For other ways to get there, Click Here.
For Excel Versions Prior to Excel 2007 Go to Tools > Macros > Visual Basic Editor
For Excel 2007 Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon. Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic
- On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
- If the Macro goes in a Module, Click Here, otherwise continue to Step 8.
- Go to the menu at the top of the window and click Insert > Module
- Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
- Go to Step 8.
- If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Go to Step 8.
- If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE). Select the sheet in which you want the macro to run and double-click that sheet.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
- Go to Step 8.
- Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
- You are now ready to run the macro.
Similar Helpful Excel Resources
I am looking for a way to trap the case when an embedded chart is
deleted. I already have a chart Event class setup and am currently
handling Calculate events. I just need to know which event to trap on
a chart delete so that I can "disconnect" some things behind the scenes
that still think a chart is out there, when, in fact, it has been
deleted. Thanks in advance for any help.
Roy
I created a user interface that the use of the MouseUp event to detect the data label or point the user selects on an embedded chart (I have a EmbChart class setup to handle events on the embedded chart). This selection leads to a dialog box and additional procedures that I've written.
My problem is that the UI seems really clunky when selecting on a particular label draws selection boxes (usually around ALL the data labels) or selects all of the points. Also, the cursour that usually comes-up when you hover over a chart isn't idea for selecting points. The behavior I want is actually what the chart looks like when it is protected. My problem is if the chart is protected, by MouseUp event doesn't trigger?
Is there either a way to allow the MouseUp event to work when the chart is protected or a way to disable drawing the object section?
For reference, my MouseUp event is currently based on the code described at http://forums.techguy.org/business-a...eup-event.html.
Thank you!
Hi, I would like to delete all sheets that begin with "Chart" using a Macros in a workbook.
Any help would be appreciated. I found a macros online but it exits my workbook.
I created a user interface that the use of the MouseUp event to detect the data label or point the user selects on an embedded chart (I have a EmbChart class setup to handle events on the embedded chart). This selection leads to a dialog box and additional procedures that I've written.
My problem is that the UI seems really clunky when selecting on a particular label draws selection boxes (usually around ALL the data labels) or selects all of the points. Also, the cursour that usually comes-up when you hover over a chart isn't idea for selecting points. The behavior I want is actually what the chart looks like when it is protected. My problem is if the chart is protected, by MouseUp event doesn't trigger?
Is there either a way to allow the MouseUp event to work when the chart is protected or a way to disable drawing the object section?
For reference, my MouseUp event is currently based on the code described at http://forums.techguy.org/business-a...eup-event.html.
Thank you!
Probably a really simple answer but how to i delete references to SHEET B in formula's in SHEET A so I can delete SHEET B not get #REF errors in the formula's in SHEET A.
Cheers in advance.
Hi,
I have a presentation that I need to put together in PPT, and I've built all the charts in Excel. The problem is that I need both the chart and the data to live solely in PowerPoint (and be editable) without linking back to the original Excel file.
I'm trying to do this in either Excel/PPT 2003 or 2007.
Thanks
Hi All,
I am new to excel pivot table/charts. I have to create a Employee Progress Tracker where each employee has a separate worksheet to fill in the Tasks/Actions done by him/her.
The columns(headings) are the same for each employee but the number of rows can differ. I have to create something that enables my Senior Manager to pick from a drop down menu from the Main worksheet and display the information as a bar chart around
Employee (to be selected from a drop down menu listing all the employees)
The date range (can be a free form fields with Start Date and End Date i-e 1/3/2011 to 3/2011).
The Tasks the performed by the employee during the selected date range.
The percentage of the task completed.
Thankyou
I have four monitors (ATI viedo cards) and an Excel 2007 spread sheet that processes data from an outside vendor via DDE. The spread sheet has a macro that causes the printing of a row of data about three times a minute. I have setup the monitors so that that I have the outside vendor's chart on monitor #1; and my excel spread sheet on monitor #2.
How do I move the two chart sheets to monitor #3 and monitor #4 so that charts #3 & 4 will update automatically as Excel prints another row of data? As it is now I have to activate charts #3 &4 to make them update.
Hi all,
I was wondering whether anyone else has experienced Excel forgetting the names of chart sheets.
I have a spreadsheet with a couple of worksheets that hold data and 6 further tabs that are chart sheets. Whenever I rename the chart sheets and save the file the name of the chart sheets are lost. On reopening the file they have reverted to being called Chart1, Chart2 etc...
Any ideas? Is this a bug/known issue?
Cheers,
Rob
Hi
I have a spreadsheet which contains Areas in them. So for instance, when I got to the name box to the right of the formula bar I can select a named area and it will highlight that area. I think as a default there is Print_Area.
In the spreadsheet I am using there are several 'Areas' set up by a colleague that are no longer needed. To make things easier when looking for the needed Areas, I was hoping to delete the Areas set up by my colleague. How do I do this?
|
|