cellMatrix.net

Spreadsheet Modeling and Related Topics

Delete All Embedded Charts from a Workbook

Earlier this week a coworker approached me with a workbook that she needed help with. Although the workbook appeared to contain only text values, it was prompting to update links every time it was opened. Upon using Bill Manville's FindLink Utility, we were able to find links to embedded charts that had been hidden somewhere in the workbook. Since she didn't need the charts, we used the following macro to delete all of the embedded charts in her workbook.

Sub Loop_Thru_Embedded_Chart_Objects()
    Dim Sht As Worksheet
    Dim ChtObj As ChartObject
    For Each Sht In ActiveWorkbook.Sheets
        For Each ChtObj In Sht.ChartObjects
            ChtObj.Delete
        Next ChtObj
    Next Sht
End Sub

Posted on Thursday, October 29, 2009 | Comments (2) | Permalink
Comments

Here’s a smaller version:

Sub Loop_Thru_Embedded_Chart_Objects()
  Dim Sht As Worksheet
  Dim ChtObj As ChartObject
  For Each Sht In ActiveWorkbook.Sheets
      Sht.ChartObjects.Delete
  Next Sht
End Sub

You can delete the entire collection of chart objects in one command.

Posted by Jon Peltier  on  10/29  at  10:19 AM

Jon - thanks. Deleting the collection is much more efficient - didn’t think of that.

Posted by .(JavaScript must be enabled to view this email address)  on  11/03  at  05:27 AM
Page 1 of 1 pages

Comment Entry Form

User Information

Name: (Required)

E-Mail Address: (Optional)

Location: (Optional)

Web Site Address: (Optional)

Comment Formatting Reference
Add VBA Code:
<pre>some code here</pre>
Linking:
[url]http://www.example.com/[/url]
[url=http://www.example.com/]my site[/url]
Text Formatting
[size=4]Some larger text[/size]
[color=green]Some green text[/color]
[b]Some bold text[/b]
[i]Some italic text[/i]
Enter Comment Below

Personalization Options
Remember my personal information
Notify me of follow-up comments?

Next entry: Show Gridlines when Filling an Interior Range

Previous entry: Formula Trace Tool for Excel 2007

<< Back to main

Statistics

  • Total Entries - 136
  • Current Viewers - 28

Categories

Entries by Day

Sep - 2010
S M T W T F S
29 30 31 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 1 2

Recent Comments

Syndicate