<?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 Conditional Formatting of Charts by Series Name</title>
	<atom:link href="http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-series-name/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-series-name/</link>
	<description>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Wed, 23 May 2012 11:03:15 +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-conditional-formatting-of-charts-by-series-name/comment-page-2/#comment-175346</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Fri, 20 Jan 2012 16:00:37 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-series-name/#comment-175346</guid>
		<description>Leah -

&quot;Neither worked&quot;... The code ran for me, though it didn&#039;t match the colors exactly. Do the labels in the patterns range exactly match the series names (spelling and capitalization)?

Excel 2007+ uses different chart formatting syntax than I wrote about.

Try this variation:

&lt;pre class=&quot;vbasmall&quot;&gt;&lt;code&gt;Sub ColorBySeriesName()
  Dim rPatterns As Range
  Dim iSeries As Long
  Dim rSeries As Range
  Dim MyChart As Chart

  Set rPatterns = Sheets(&quot;DATA&quot;).Range(&quot;C19:C25&quot;)
  Set MyChart = Sheets(&quot;DATA&quot;).ChartObjects(&quot;IA IT PROJECTS&quot;).Chart
  With MyChart
    For iSeries = 1 To .SeriesCollection.Count
      Set rSeries = rPatterns.Find(What:=.SeriesCollection(iSeries).Name, LookAt:=xlWhole)
      If Not rSeries Is Nothing Then
        .SeriesCollection(iSeries).Format.Fill.ForeColor.RGB = rSeries.Interior.Color
      End If
    Next
  End With
End Sub&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Leah -</p>
<p>&#8220;Neither worked&#8221;&#8230; The code ran for me, though it didn&#8217;t match the colors exactly. Do the labels in the patterns range exactly match the series names (spelling and capitalization)?</p>
<p>Excel 2007+ uses different chart formatting syntax than I wrote about.</p>
<p>Try this variation:</p>
<pre class="vbasmall"><code>Sub ColorBySeriesName()
  Dim rPatterns As Range
  Dim iSeries As Long
  Dim rSeries As Range
  Dim MyChart As Chart

  Set rPatterns = Sheets("DATA").Range("C19:C25")
  Set MyChart = Sheets("DATA").ChartObjects("IA IT PROJECTS").Chart
  With MyChart
    For iSeries = 1 To .SeriesCollection.Count
      Set rSeries = rPatterns.Find(What:=.SeriesCollection(iSeries).Name, LookAt:=xlWhole)
      If Not rSeries Is Nothing Then
        .SeriesCollection(iSeries).Format.Fill.ForeColor.RGB = rSeries.Interior.Color
      End If
    Next
  End With
End Sub</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leah</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-series-name/comment-page-2/#comment-174748</link>
		<dc:creator>Leah</dc:creator>
		<pubDate>Wed, 18 Jan 2012 16:39:41 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-series-name/#comment-174748</guid>
		<description>Jon,

I can&#039;t thank you enough for the help on your site.  I have successfully built the Gantt Chart for Repeated Tasks and now need the bar for each task to be a different color based on selections set by user. (In other words, I do not want to individually format each bar)

I&#039;ve attempted the VBA format by Series Name as well as by Category Label and haven&#039;t gotten anywhere.  I was thinking it may be due to the layers of different series in the Gantt chart?  Anyhow, here is the current code I&#039;m working with (one Sheet named DATA and one Chart named IA IT PROJECTS):

Sub ColorBySeriesName()
    Dim rPatterns As Range
    Dim iSeries As Long
    Dim rSeries As Range
    
    Set rPatterns = Sheets(&quot;DATA&quot;).Range(&quot;C19:C25&quot;)
    ActiveSheet.ChartObjects(&quot;IA IT PROJECTS&quot;).Activate
    With ActiveChart
      For iSeries = 1 To .SeriesCollection.Count
        Set rSeries = rPatterns.Find(What:=.SeriesCollection(iSeries).Name, LookAt:=xlWhole)
        If Not rSeries Is Nothing Then
        .SeriesCollection(iSeries).Interior.ColorIndex = rSeries.Interior.ColorIndex
    End If
    Next
 End With
End Sub

I had first color coded the 7 task names (AKA Ambulance 1, 2, 4, 7 from your charting tutorial) but thought maybe I should color code the associated number - neither worked.

Currently, this is my error: &quot;Run-time error &#039;5&#039;: Invalid procedure call or argument&quot;

As you can probably guess, this is my first experience with VBA.

Thank you in advance.

Sincerely,
Leah</description>
		<content:encoded><![CDATA[<p>Jon,</p>
<p>I can&#8217;t thank you enough for the help on your site.  I have successfully built the Gantt Chart for Repeated Tasks and now need the bar for each task to be a different color based on selections set by user. (In other words, I do not want to individually format each bar)</p>
<p>I&#8217;ve attempted the VBA format by Series Name as well as by Category Label and haven&#8217;t gotten anywhere.  I was thinking it may be due to the layers of different series in the Gantt chart?  Anyhow, here is the current code I&#8217;m working with (one Sheet named DATA and one Chart named IA IT PROJECTS):</p>
<p>Sub ColorBySeriesName()<br />
    Dim rPatterns As Range<br />
    Dim iSeries As Long<br />
    Dim rSeries As Range</p>
<p>    Set rPatterns = Sheets(&#8220;DATA&#8221;).Range(&#8220;C19:C25&#8243;)<br />
    ActiveSheet.ChartObjects(&#8220;IA IT PROJECTS&#8221;).Activate<br />
    With ActiveChart<br />
      For iSeries = 1 To .SeriesCollection.Count<br />
        Set rSeries = rPatterns.Find(What:=.SeriesCollection(iSeries).Name, LookAt:=xlWhole)<br />
        If Not rSeries Is Nothing Then<br />
        .SeriesCollection(iSeries).Interior.ColorIndex = rSeries.Interior.ColorIndex<br />
    End If<br />
    Next<br />
 End With<br />
End Sub</p>
<p>I had first color coded the 7 task names (AKA Ambulance 1, 2, 4, 7 from your charting tutorial) but thought maybe I should color code the associated number &#8211; neither worked.</p>
<p>Currently, this is my error: &#8220;Run-time error &#8217;5&#8242;: Invalid procedure call or argument&#8221;</p>
<p>As you can probably guess, this is my first experience with VBA.</p>
<p>Thank you in advance.</p>
<p>Sincerely,<br />
Leah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-series-name/comment-page-2/#comment-94807</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Tue, 10 May 2011 15:01:42 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-series-name/#comment-94807</guid>
		<description>You&#039;ve misplaced the If/Then statement

&lt;pre class=&quot;vbasmall&quot;&gt;&lt;code&gt;With ActiveChart
  For iSeries = 1 To .SeriesCollection.Count
    Set rSeries = rPatterns.Find(What:=.SeriesCollection(iSeries).Name, LookAt:=xlWhole)
    If Not rSeries Is Nothing Then
      .SeriesCollection(iSeries).Interior.ColorIndex = rSeries.Interior.ColorIndex
    End If
  Next
End With&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>You&#8217;ve misplaced the If/Then statement</p>
<pre class="vbasmall"><code>With ActiveChart
  For iSeries = 1 To .SeriesCollection.Count
    Set rSeries = rPatterns.Find(What:=.SeriesCollection(iSeries).Name, LookAt:=xlWhole)
    If Not rSeries Is Nothing Then
      .SeriesCollection(iSeries).Interior.ColorIndex = rSeries.Interior.ColorIndex
    End If
  Next
End With</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexis</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-series-name/comment-page-2/#comment-94639</link>
		<dc:creator>Alexis</dc:creator>
		<pubDate>Mon, 09 May 2011 20:05:02 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-series-name/#comment-94639</guid>
		<description>This code is exactly what I need but I can&#039;t get it to work.  I have a chart with a list of categories that I&#039;d like to code.  The categories are in sheet &quot;seriescolors&quot; and each cell has been colored with the color I&#039;d like the series.  The chart is in a sheet called &quot;exhibit&quot;.

Dim rPatterns As Range
Dim iSeries As Long
Dim rSeries As Range

&#039; Set location of category names and their colors
Set rPatterns = ActiveWorkbook.Worksheets(&quot;seriescolors&quot;).Range(&quot;A1:A19&quot;)
 
/*Then there&#039;s code that generates the chart*/

     With ActiveChart

        For iSeries = 1 To .SeriesCollection.Count
            Set rSeries = rPatterns.Find(What:=.SeriesCollection(iSeries).Name, LookAt:=xlWhole)
             
                .SeriesCollection(iSeries).Interior.ColorIndex = rSeries.Interior.ColorIndex
                Next
                
                If Not rSeries Is Nothing Then
                .SeriesCollection(iSeries).Interior.ColorIndex = rSeries.Interior.ColorIndex
                 End If
    End With

It gives me an error at &quot;.SeriesCollection(iSeries).Interior - &quot;Object Variable or With Block Not Set&quot; and the &quot;iSeries&quot; is coming up as 1.  Any ideas what might be wrong here?  Let me know if I can give more detail.  Thanks!!!</description>
		<content:encoded><![CDATA[<p>This code is exactly what I need but I can&#8217;t get it to work.  I have a chart with a list of categories that I&#8217;d like to code.  The categories are in sheet &#8220;seriescolors&#8221; and each cell has been colored with the color I&#8217;d like the series.  The chart is in a sheet called &#8220;exhibit&#8221;.</p>
<p>Dim rPatterns As Range<br />
Dim iSeries As Long<br />
Dim rSeries As Range</p>
<p>&#8216; Set location of category names and their colors<br />
Set rPatterns = ActiveWorkbook.Worksheets(&#8220;seriescolors&#8221;).Range(&#8220;A1:A19&#8243;)</p>
<p>/*Then there&#8217;s code that generates the chart*/</p>
<p>     With ActiveChart</p>
<p>        For iSeries = 1 To .SeriesCollection.Count<br />
            Set rSeries = rPatterns.Find(What:=.SeriesCollection(iSeries).Name, LookAt:=xlWhole)</p>
<p>                .SeriesCollection(iSeries).Interior.ColorIndex = rSeries.Interior.ColorIndex<br />
                Next</p>
<p>                If Not rSeries Is Nothing Then<br />
                .SeriesCollection(iSeries).Interior.ColorIndex = rSeries.Interior.ColorIndex<br />
                 End If<br />
    End With</p>
<p>It gives me an error at &#8220;.SeriesCollection(iSeries).Interior &#8211; &#8220;Object Variable or With Block Not Set&#8221; and the &#8220;iSeries&#8221; is coming up as 1.  Any ideas what might be wrong here?  Let me know if I can give more detail.  Thanks!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris Parizot</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-series-name/comment-page-2/#comment-65365</link>
		<dc:creator>Boris Parizot</dc:creator>
		<pubDate>Thu, 03 Feb 2011 17:24:47 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-series-name/#comment-65365</guid>
		<description>I was trying to find such function in Excel for a real while and could never achieve it ! Thanks !!
However, I had the 2007 problem that the color were not properly picked-up.
Also, even though I understand almost nothing to what I am doing, I found a crosoft page describing the iColorIndex function, where they actually say you can use iColor instead, what I did and works perfectly...
Thank you again for the code !</description>
		<content:encoded><![CDATA[<p>I was trying to find such function in Excel for a real while and could never achieve it ! Thanks !!<br />
However, I had the 2007 problem that the color were not properly picked-up.<br />
Also, even though I understand almost nothing to what I am doing, I found a crosoft page describing the iColorIndex function, where they actually say you can use iColor instead, what I did and works perfectly&#8230;<br />
Thank you again for the code !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-series-name/comment-page-2/#comment-62353</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Sat, 22 Jan 2011 17:07:59 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-series-name/#comment-62353</guid>
		<description>Hi Karyn -

I&#039;ve made no effort to make a mobile version of my blog. That said, my Droid displays my website with a minimum of distortion. It&#039;s probably an incompatibility with the iPhone browser.</description>
		<content:encoded><![CDATA[<p>Hi Karyn -</p>
<p>I&#8217;ve made no effort to make a mobile version of my blog. That said, my Droid displays my website with a minimum of distortion. It&#8217;s probably an incompatibility with the iPhone browser.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

