Microsoft KB Archive/124232

From BetaArchive Wiki

Article ID: 124232

Article Last Modified on 10/11/2006



APPLIES TO

  • Microsoft Excel 97 Standard Edition
  • Microsoft Excel 95 Standard Edition
  • Microsoft Excel 5.0 Standard Edition



This article was previously published under Q124232


SUMMARY

Although charts in Microsoft Excel are, by default, linked to the range of cells on the worksheets that they were created from, these links can be broken by converting the cell references in the SERIES formula for the chart to values. This article contains a sample Visual Basic for Applications macro that you can use to do this.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following macro can be run for any active chart. For the purpose of this macro, a chart is active when any of the following are true:

  • A Microsoft Excel chart sheet is active. -or-


  • A chart embedded on a worksheet is selected by clicking it. -or-


  • A chart embedded on a worksheet is activated by double-clicking (versions 5.0 and 7.0).

Visual Basic Code Example

   Sub BreakChartLinks()

   For Each x In ActiveChart.SeriesCollection
      x.Values = x.Values
      x.XValues = x.XValues
      x.Name = x.Name
   Next x

   End Sub
                

REFERENCES

"Microsoft Excel User's Guide," version 5.0, Chapter 15, page 269, "Activating an Embedded Chart"

For more information about the Values property, click the Search button in Visual Basic Programming Help and type:

Values


For additional information about how to automate removal of links in Microsoft Excel 97 for Windows, click the following article number to view the article in the Microsoft Knowledge Base:

188449 XL97: Delete Links Wizard Available


For additional information about to how to break links, click the following article number to view the article in the Microsoft Knowledge Base:

214139 XL2000: How to Break Links Between a Chart and a Worksheet



Additional query words: 5.00a 5.00c 7.00a 97 break link XL

Keywords: kbdtacode kbprogramming KB124232