<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Dynamic Chart Source Data</title>
	<atom:link href="http://peltiertech.com/WordPress/dynamic-chart-source-data/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/</link>
	<description>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Tue, 16 Mar 2010 21:53:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-25515</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Thu, 14 Jan 2010 14:58:51 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-25515</guid>
		<description>&quot;Me&quot; refers to the sheet that the code is attached to. Since the code fires when the data changes, it should go on the code module for the sheet with the chart data.

Me.Range(“ChtSourceData”) is still correct. To access the chart you need 
ThisWorkbook.Sheets(“SheetName”).ChartObjects(1).Chart

Note that the Worksheet_Change event will not detect a change if the formulas update to new values but the formulas themselves are unchanged. You can use the Worksheet_Calculate event, but you have to be careful that this doesn&#039;t really bog things down.

Link formulas shouldn&#039;t bog down the workbook very much.</description>
		<content:encoded><![CDATA[<p>&#8220;Me&#8221; refers to the sheet that the code is attached to. Since the code fires when the data changes, it should go on the code module for the sheet with the chart data.</p>
<p>Me.Range(“ChtSourceData”) is still correct. To access the chart you need<br />
ThisWorkbook.Sheets(“SheetName”).ChartObjects(1).Chart</p>
<p>Note that the Worksheet_Change event will not detect a change if the formulas update to new values but the formulas themselves are unchanged. You can use the Worksheet_Calculate event, but you have to be careful that this doesn&#8217;t really bog things down.</p>
<p>Link formulas shouldn&#8217;t bog down the workbook very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam R</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-25499</link>
		<dc:creator>Sam R</dc:creator>
		<pubDate>Thu, 14 Jan 2010 08:48:18 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-25499</guid>
		<description>Hi Jon,

Thanks for this tip. I am working with graphs on one excel sheet that will have to update according to data located in another sheet.

Is there anyway to modify the macro &quot;Private Sub Worksheet_Change(ByVal Target As Range)&quot; to take this into account?

I have tried to add sheet names to:
-Me.Range(&quot;ChtSourceData&quot;)  --&gt; Me.Sheets(&quot;SheetName&quot;).Range(&quot;ChtSourceData&quot;)
or
-Me.ChartObjects(1).Chart --&gt; Me.Sheets(&quot;SheetName&quot;).ChartObjects(1).Chart

But got an error message every time. The reason I don&#039;t want to simply put &quot;=&quot; links from one sheet to another to have all data on the same sheet is that the excel file I am working with is already quite slow due to other calculations.</description>
		<content:encoded><![CDATA[<p>Hi Jon,</p>
<p>Thanks for this tip. I am working with graphs on one excel sheet that will have to update according to data located in another sheet.</p>
<p>Is there anyway to modify the macro &#8220;Private Sub Worksheet_Change(ByVal Target As Range)&#8221; to take this into account?</p>
<p>I have tried to add sheet names to:<br />
-Me.Range(&#8220;ChtSourceData&#8221;)  &#8211;&gt; Me.Sheets(&#8220;SheetName&#8221;).Range(&#8220;ChtSourceData&#8221;)<br />
or<br />
-Me.ChartObjects(1).Chart &#8211;&gt; Me.Sheets(&#8220;SheetName&#8221;).ChartObjects(1).Chart</p>
<p>But got an error message every time. The reason I don&#8217;t want to simply put &#8220;=&#8221; links from one sheet to another to have all data on the same sheet is that the excel file I am working with is already quite slow due to other calculations.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-21793</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Sat, 07 Nov 2009 15:36:41 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-21793</guid>
		<description>Ardalan -

I see. You may have one to 30 series, and you want the existing data sets to automatically be charted. Any data sets which are removed, you want the series also removed. This could ba accomplished through a dedicated VBA procedure.

I assumed one worksheet, ChartData, which had potentially plottable data in A1:P20, and which also had one embedded chart, the one to be upddated. This procedure clears all series from the chart, checks each pair of columns in the data range, and if both columns contain plottable data (e.g., not errors), a series is added using these two columns.

&lt;pre class=&quot;vbasmall&quot;&gt;Sub DynamicChartRange()
  Const sADDRESS As String = &quot;A1:P20&quot;
  Dim rTotal As Range
  Dim cDynamic As Chart
  Dim iSrs As Long
  
  Set rTotal = Worksheets(&quot;ChartData&quot;).Range(sADDRESS)
  Set cDynamic = Worksheets(&quot;ChartData&quot;).ChartObjects(1).Chart
  
  &#039; clear the chart
  Do While cDynamic.SeriesCollection.Count &gt; 0
    cDynamic.Legend.LegendEntries(1).LegendKey.Delete
  Loop
  
  &#039; add series from total range
  For iSrs = 1 To rTotal.Columns.Count / 2
    &#039; check columns for data
    If WorksheetFunction.Count(rTotal.Columns(iSrs * 2 - 1)) &gt; 0 And _
        WorksheetFunction.Count(rTotal.Columns(iSrs * 2)) &gt; 0 Then
      &#039; we have data to plot
      With cDynamic.SeriesCollection.NewSeries
        .Values = rTotal.Columns(iSrs * 2)
        .XValues = rTotal.Columns(iSrs * 2 - 1)
      End With
    End If
  Next
  
End Sub&lt;br /&gt;
&#160;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>Ardalan -</p>
<p>I see. You may have one to 30 series, and you want the existing data sets to automatically be charted. Any data sets which are removed, you want the series also removed. This could ba accomplished through a dedicated VBA procedure.</p>
<p>I assumed one worksheet, ChartData, which had potentially plottable data in A1:P20, and which also had one embedded chart, the one to be upddated. This procedure clears all series from the chart, checks each pair of columns in the data range, and if both columns contain plottable data (e.g., not errors), a series is added using these two columns.</p>
<pre class="vbasmall">Sub DynamicChartRange()
  Const sADDRESS As String = "A1:P20"
  Dim rTotal As Range
  Dim cDynamic As Chart
  Dim iSrs As Long

  Set rTotal = Worksheets("ChartData").Range(sADDRESS)
  Set cDynamic = Worksheets("ChartData").ChartObjects(1).Chart

  ' clear the chart
  Do While cDynamic.SeriesCollection.Count > 0
    cDynamic.Legend.LegendEntries(1).LegendKey.Delete
  Loop

  ' add series from total range
  For iSrs = 1 To rTotal.Columns.Count / 2
    ' check columns for data
    If WorksheetFunction.Count(rTotal.Columns(iSrs * 2 - 1)) > 0 And _
        WorksheetFunction.Count(rTotal.Columns(iSrs * 2)) > 0 Then
      ' we have data to plot
      With cDynamic.SeriesCollection.NewSeries
        .Values = rTotal.Columns(iSrs * 2)
        .XValues = rTotal.Columns(iSrs * 2 - 1)
      End With
    End If
  Next

End Sub
&nbsp;</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ardalan</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-21773</link>
		<dc:creator>Ardalan</dc:creator>
		<pubDate>Sat, 07 Nov 2009 04:50:01 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-21773</guid>
		<description>Jon,
The ranges are like this:
X 1 = A1:A500     Y 1 = B1:B500
X 2 = C1:C500    Y 2 = D1:D500
.
.
X 30 = AD1:AD500    Y 30 = AE1:AE500
These data come from some calculations of other data. I have put a formula if there is no data it replies #N/A for my graph. For each X &amp; Y graph should draw a line. I want this adding happens automatically, ie.; if I have 3 set of XY data , the chart only draw 3 lines &amp; in case I add more to these 3, say 2, Graph should automatically add another 2 series &amp; shows 5 lines and in case I delete one, graph reduces one.</description>
		<content:encoded><![CDATA[<p>Jon,<br />
The ranges are like this:<br />
X 1 = A1:A500     Y 1 = B1:B500<br />
X 2 = C1:C500    Y 2 = D1:D500<br />
.<br />
.<br />
X 30 = AD1:AD500    Y 30 = AE1:AE500<br />
These data come from some calculations of other data. I have put a formula if there is no data it replies #N/A for my graph. For each X &amp; Y graph should draw a line. I want this adding happens automatically, ie.; if I have 3 set of XY data , the chart only draw 3 lines &amp; in case I add more to these 3, say 2, Graph should automatically add another 2 series &amp; shows 5 lines and in case I delete one, graph reduces one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-21750</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Fri, 06 Nov 2009 17:38:27 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-21750</guid>
		<description>Ardelan - 

How is the source data changing? Is the range changing size?

You might be able to use the utility in &lt;a href=&quot;http://peltiertech.com/WordPress/how-to-edit-series-formulas/&quot; title=&quot;How to Edit Series Formulas &#124; PTS Blog&quot; rel=&quot;nofollow&quot;&gt;How to Edit Series Formulas&lt;/a&gt; to adjust the last row, especially if all data ends at the same row.</description>
		<content:encoded><![CDATA[<p>Ardelan &#8211; </p>
<p>How is the source data changing? Is the range changing size?</p>
<p>You might be able to use the utility in <a href="http://peltiertech.com/WordPress/how-to-edit-series-formulas/" title="How to Edit Series Formulas | PTS Blog" rel="nofollow">How to Edit Series Formulas</a> to adjust the last row, especially if all data ends at the same row.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ardalan</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-21745</link>
		<dc:creator>Ardalan</dc:creator>
		<pubDate>Fri, 06 Nov 2009 16:02:17 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-21745</guid>
		<description>Hi Jon,
Thanx for your great ideas.
I have a problem with making a X-Y dynamic chart. Actually i have around 30 X &amp; 30 Y values in collumns tight together (X1 Y1, X2 Y2, etc) that can be shown in X-Y graph. What should I do that graph can be updated automatically without using source data/addseries one by one.</description>
		<content:encoded><![CDATA[<p>Hi Jon,<br />
Thanx for your great ideas.<br />
I have a problem with making a X-Y dynamic chart. Actually i have around 30 X &amp; 30 Y values in collumns tight together (X1 Y1, X2 Y2, etc) that can be shown in X-Y graph. What should I do that graph can be updated automatically without using source data/addseries one by one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-6242</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Wed, 19 Nov 2008 10:58:32 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-6242</guid>
		<description>CIBER -

I generally use Forms menu controls for this, but you can use validation just as well. 

When using worksheet formulas, usually OFFSET and INDEX are used to define the position and size of a range. In VBA one uses .Offset and .Resize for the same purpose. Your arguments for these functions have to include references to the cells with the validation or control link values.

For example, referring to the Name defined at the top of this article:

&lt;pre class=&quot;vba&quot;&gt;Name: ChtSourceData
Refers To: =OFFSET(Sheet1!$B$2,0,0,COUNTA(Sheet1!$B:$B)+1,COUNTA(Sheet1!$2:$2)+1)&lt;/pre&gt;

If cell D1 contains the value that indicates my row offset for the start of the data, I would insert it into this formula:

&lt;pre class=&quot;vba&quot;&gt;Name: ChtSourceData
Refers To: =OFFSET(Sheet1!$B$2,&lt;span style=&quot;color: red;&quot;&gt;Sheet1!$D$1&lt;/span&gt;,0,COUNTA(Sheet1!$B:$B)+1,COUNTA(Sheet1!$2:$2)+1)&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>CIBER -</p>
<p>I generally use Forms menu controls for this, but you can use validation just as well. </p>
<p>When using worksheet formulas, usually OFFSET and INDEX are used to define the position and size of a range. In VBA one uses .Offset and .Resize for the same purpose. Your arguments for these functions have to include references to the cells with the validation or control link values.</p>
<p>For example, referring to the Name defined at the top of this article:</p>
<pre class="vba">Name: ChtSourceData
Refers To: =OFFSET(Sheet1!$B$2,0,0,COUNTA(Sheet1!$B:$B)+1,COUNTA(Sheet1!$2:$2)+1)</pre>
<p>If cell D1 contains the value that indicates my row offset for the start of the data, I would insert it into this formula:</p>
<pre class="vba">Name: ChtSourceData
Refers To: =OFFSET(Sheet1!$B$2,<span style="color: red;">Sheet1!$D$1</span>,0,COUNTA(Sheet1!$B:$B)+1,COUNTA(Sheet1!$2:$2)+1)</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: CIBER</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-6238</link>
		<dc:creator>CIBER</dc:creator>
		<pubDate>Wed, 19 Nov 2008 09:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-6238</guid>
		<description>I have a senario in which i have to change the source data of the graph by using some validation inputs, 
Eg : i have a set of data in rows which is used to create the graph , now i have to change the source data with refference to the a particular row. 
+ values  to select the rows  after refference  row &amp; -ve for rows before refference row .

say if i give +3 , -5 , then the source data become 5+3+1(reffernce row ) = 9 rows totally shd be used to create the graph 

All this has to be done dyanamically how can it be done.</description>
		<content:encoded><![CDATA[<p>I have a senario in which i have to change the source data of the graph by using some validation inputs,<br />
Eg : i have a set of data in rows which is used to create the graph , now i have to change the source data with refference to the a particular row.<br />
+ values  to select the rows  after refference  row &amp; -ve for rows before refference row .</p>
<p>say if i give +3 , -5 , then the source data become 5+3+1(reffernce row ) = 9 rows totally shd be used to create the graph </p>
<p>All this has to be done dyanamically how can it be done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-4586</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Fri, 03 Oct 2008 20:56:40 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-4586</guid>
		<description>Nick -

In my example, the series names are in the first row of the range &quot;ChtSourceData&quot;. Keep the top left cell blank, put the series names in the rest of the top row of this range, and the X values or category labels in the rest of the first row.</description>
		<content:encoded><![CDATA[<p>Nick -</p>
<p>In my example, the series names are in the first row of the range &#8220;ChtSourceData&#8221;. Keep the top left cell blank, put the series names in the rest of the top row of this range, and the X values or category labels in the rest of the first row.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://peltiertech.com/WordPress/dynamic-chart-source-data/comment-page-1/#comment-4584</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Fri, 03 Oct 2008 20:48:08 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=136#comment-4584</guid>
		<description>Jon,

Cam across your website in need of excel guidance.
This is great and I have been playing with this and learning.

However, when I execute the code, it resets the labeling of the series in the chart.
Thinking about it, I could define a name for each series and then add an update into the macro to update the series using the definition but I think there must be a quicker way of doing this especially when there are several series.

Thanks,
Nick</description>
		<content:encoded><![CDATA[<p>Jon,</p>
<p>Cam across your website in need of excel guidance.<br />
This is great and I have been playing with this and learning.</p>
<p>However, when I execute the code, it resets the labeling of the series in the chart.<br />
Thinking about it, I could define a name for each series and then add an update into the macro to update the series using the definition but I think there must be a quicker way of doing this especially when there are several series.</p>
<p>Thanks,<br />
Nick</p>
]]></content:encoded>
	</item>
</channel>
</rss>
