<?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: VBA to Split Data Range into Multiple Chart Series</title>
	<atom:link href="http://peltiertech.com/WordPress/vba-to-split-data-range-into-multiple-chart-series/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress/vba-to-split-data-range-into-multiple-chart-series/</link>
	<description>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Fri, 10 Feb 2012 23:37:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
<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/vba-to-split-data-range-into-multiple-chart-series/comment-page-1/#comment-142847</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Thu, 13 Oct 2011 02:41:56 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=77#comment-142847</guid>
		<description>Those enumeration constants are nothing new. They were part of the earliest incarnation of VBA from Excel 95. You can find out about them from the Object Browser in the VB Editor, or via Google.</description>
		<content:encoded><![CDATA[<p>Those enumeration constants are nothing new. They were part of the earliest incarnation of VBA from Excel 95. You can find out about them from the Object Browser in the VB Editor, or via Google.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: m.garber</title>
		<link>http://peltiertech.com/WordPress/vba-to-split-data-range-into-multiple-chart-series/comment-page-1/#comment-142692</link>
		<dc:creator>m.garber</dc:creator>
		<pubDate>Wed, 12 Oct 2011 16:35:50 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=77#comment-142692</guid>
		<description>Dr. Peltier: 
As a fan of Peltier Tech Chart tutorials of the 2003 era I am disappointed (whether or not I have a right to be) with 2007 VBA programming discussions in current tutorials. To be specific, the so-called enumeration constants appear frequently now with no introduction or discussion, for example in &quot;Line and Fill Effects, etc.&quot;, and in N. Hebbs&#039; guest article about Autoshapes. My concern is with X-Y Chart formatting, so when msoConstants crop up on p.582 of Walkenbach&#039;s Power Programming without further or previous ado, a rank amateur is left bewildered.
It would be nice if you would write something on this if you consider it worth your while.
Sincerely, 
M. Garber
Bellport, NY</description>
		<content:encoded><![CDATA[<p>Dr. Peltier:<br />
As a fan of Peltier Tech Chart tutorials of the 2003 era I am disappointed (whether or not I have a right to be) with 2007 VBA programming discussions in current tutorials. To be specific, the so-called enumeration constants appear frequently now with no introduction or discussion, for example in &#8220;Line and Fill Effects, etc.&#8221;, and in N. Hebbs&#8217; guest article about Autoshapes. My concern is with X-Y Chart formatting, so when msoConstants crop up on p.582 of Walkenbach&#8217;s Power Programming without further or previous ado, a rank amateur is left bewildered.<br />
It would be nice if you would write something on this if you consider it worth your while.<br />
Sincerely,<br />
M. Garber<br />
Bellport, NY</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://peltiertech.com/WordPress/vba-to-split-data-range-into-multiple-chart-series/comment-page-1/#comment-117941</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 08 Aug 2011 20:56:48 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=77#comment-117941</guid>
		<description>Thank you, thank you, thank you!</description>
		<content:encoded><![CDATA[<p>Thank you, thank you, thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention VBA to Split Data Range into Multiple Chart Series - -- Topsy.com</title>
		<link>http://peltiertech.com/WordPress/vba-to-split-data-range-into-multiple-chart-series/comment-page-1/#comment-57438</link>
		<dc:creator>Tweets that mention VBA to Split Data Range into Multiple Chart Series - -- Topsy.com</dc:creator>
		<pubDate>Fri, 31 Dec 2010 02:17:45 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=77#comment-57438</guid>
		<description>[...] This post was mentioned on Twitter by Teach Business. Teach Business said: RT @ThatBlokeSean: VBA to Split Data Range into Multiple Chart Series - http://peltiertech.com/WordPress/vba-to-split-data-range-into-mu ... [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by Teach Business. Teach Business said: RT @ThatBlokeSean: VBA to Split Data Range into Multiple Chart Series &#8211; <a href="http://peltiertech.com/WordPress/vba-to-split-data-range-into-mu" rel="nofollow">http://peltiertech.com/WordPress/vba-to-split-data-range-into-mu</a> &#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wynand</title>
		<link>http://peltiertech.com/WordPress/vba-to-split-data-range-into-multiple-chart-series/comment-page-1/#comment-33104</link>
		<dc:creator>wynand</dc:creator>
		<pubDate>Wed, 12 May 2010 14:05:43 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=77#comment-33104</guid>
		<description>Thanks, sorted!</description>
		<content:encoded><![CDATA[<p>Thanks, sorted!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-to-split-data-range-into-multiple-chart-series/comment-page-1/#comment-33056</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Tue, 11 May 2010 16:19:03 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=77#comment-33056</guid>
		<description>Wynand -

1. How would you use the second set of X values?

2. The code above deletes all series at the beginning of the routine, then adds back as many as it needs. New series added to a chart use default formatting. The new code below applies new data to the existing series, which reuses any customized formatting. If it needs more series, it adds them as needed. At the end, if it needed fewer series than were initially present in the chart, it removes the excess.

&lt;pre class=&quot;vbasmall&quot;&gt;&lt;code&gt;Sub PopulateChartFromTable2()
  Dim cht As Chart
  Dim rng As Range
  Dim sPrompt As String
  Dim iSrs As Long
  Dim nSrs As Long
  Dim xSrs As Long
  Dim srs As Series
  Dim iRow As Long
  Dim iRowStart As Long
  Dim iRowEnd As Long
  Dim sSeries As String

  If ActiveChart Is Nothing Then
    MsgBox &quot;Select a chart and try again.&quot;, vbExclamation
    GoTo ExitSub
  End If

  sPrompt = &quot;Select a three-column range with your data.&quot;
  sPrompt = sPrompt &amp; vbNewLine &amp; &quot;  Column 1: Series title&quot;
  sPrompt = sPrompt &amp; vbNewLine &amp; &quot;  Column 2: X values&quot;
  sPrompt = sPrompt &amp; vbNewLine &amp; &quot;  Column 3: Y values&quot;
  sPrompt = sPrompt &amp; vbNewLine &amp; &quot;Avoid blank cells&quot;

  On Error Resume Next
  Set rng = Application.InputBox(Prompt:=sPrompt, Type:=8)
  On Error GoTo 0
  If rng Is Nothing Then GoTo ExitSub

  Set cht = ActiveChart
  nSrs = cht.SeriesCollection.Count

  sSeries = &quot;&quot;
  iSrs = 0
  For iRow = 1 To rng.Rows.Count + 1
    If rng.Cells(iRow, 1).Value &lt;&gt; sSeries Or iRow &gt; rng.Rows.Count Then
      If iSrs &gt; 0 Then
        iRowEnd = iRow - 1
        If iSrs &lt;= nSrs Then
          Set srs = cht.SeriesCollection(iSrs)
        Else
          Set srs = cht.SeriesCollection.NewSeries
        End If
        With srs
          .Values = rng.Cells(iRowStart, 3).Resize(iRowEnd + 1 - iRowStart)
          .XValues = rng.Cells(iRowStart, 2).Resize(iRowEnd + 1 - iRowStart)
          .Name = rng.Cells(iRowStart, 1).Value
          .ApplyDataLabels ShowSeriesName:=True, _
              ShowCategoryName:=False, ShowValue:=False
        End With
      End If
      iRowStart = iRow
      sSeries = rng.Cells(iRow, 1).Value
      iSrs = iSrs + 1
    End If
  Next
  
  If nSrs &gt;= iSrs Then
    For xSrs = nSrs To iSrs Step -1
      cht.SeriesCollection(xSrs).Delete
    Next
  End If
  
ExitSub:
  Application.ScreenUpdating = True
End Sub&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Wynand -</p>
<p>1. How would you use the second set of X values?</p>
<p>2. The code above deletes all series at the beginning of the routine, then adds back as many as it needs. New series added to a chart use default formatting. The new code below applies new data to the existing series, which reuses any customized formatting. If it needs more series, it adds them as needed. At the end, if it needed fewer series than were initially present in the chart, it removes the excess.</p>
<pre class="vbasmall"><code>Sub PopulateChartFromTable2()
  Dim cht As Chart
  Dim rng As Range
  Dim sPrompt As String
  Dim iSrs As Long
  Dim nSrs As Long
  Dim xSrs As Long
  Dim srs As Series
  Dim iRow As Long
  Dim iRowStart As Long
  Dim iRowEnd As Long
  Dim sSeries As String

  If ActiveChart Is Nothing Then
    MsgBox "Select a chart and try again.", vbExclamation
    GoTo ExitSub
  End If

  sPrompt = "Select a three-column range with your data."
  sPrompt = sPrompt &#038; vbNewLine &#038; "  Column 1: Series title"
  sPrompt = sPrompt &#038; vbNewLine &#038; "  Column 2: X values"
  sPrompt = sPrompt &#038; vbNewLine &#038; "  Column 3: Y values"
  sPrompt = sPrompt &#038; vbNewLine &#038; "Avoid blank cells"

  On Error Resume Next
  Set rng = Application.InputBox(Prompt:=sPrompt, Type:=8)
  On Error GoTo 0
  If rng Is Nothing Then GoTo ExitSub

  Set cht = ActiveChart
  nSrs = cht.SeriesCollection.Count

  sSeries = ""
  iSrs = 0
  For iRow = 1 To rng.Rows.Count + 1
    If rng.Cells(iRow, 1).Value <> sSeries Or iRow > rng.Rows.Count Then
      If iSrs > 0 Then
        iRowEnd = iRow - 1
        If iSrs < = nSrs Then
          Set srs = cht.SeriesCollection(iSrs)
        Else
          Set srs = cht.SeriesCollection.NewSeries
        End If
        With srs
          .Values = rng.Cells(iRowStart, 3).Resize(iRowEnd + 1 - iRowStart)
          .XValues = rng.Cells(iRowStart, 2).Resize(iRowEnd + 1 - iRowStart)
          .Name = rng.Cells(iRowStart, 1).Value
          .ApplyDataLabels ShowSeriesName:=True, _
              ShowCategoryName:=False, ShowValue:=False
        End With
      End If
      iRowStart = iRow
      sSeries = rng.Cells(iRow, 1).Value
      iSrs = iSrs + 1
    End If
  Next

  If nSrs >= iSrs Then
    For xSrs = nSrs To iSrs Step -1
      cht.SeriesCollection(xSrs).Delete
    Next
  End If

ExitSub:
  Application.ScreenUpdating = True
End Sub</code></pre>
]]></content:encoded>
	</item>
</channel>
</rss>

