<?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 Category Label</title>
	<atom:link href="http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/</link>
	<description>PTS Excel Charts and Tutorials Blog</description>
	<lastBuildDate>Sat, 21 Nov 2009 04:01:08 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</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: Steven</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-16462</link>
		<dc:creator>Steven</dc:creator>
		<pubDate>Mon, 20 Jul 2009 15:46:52 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-16462</guid>
		<description>Thanks for all your help Jon, I got the thing working!! 
I found what i needed on your post &quot;VBA Conditional Formatting of Charts by Series Name&quot;. But the last code was very usefull as well!</description>
		<content:encoded><![CDATA[<p>Thanks for all your help Jon, I got the thing working!!<br />
I found what i needed on your post &#8220;VBA Conditional Formatting of Charts by Series Name&#8221;. But the last code was very usefull as well!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-16456</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Mon, 20 Jul 2009 14:39:28 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-16456</guid>
		<description>The code was written for one chart, the active chart. However, the following will make it work for all charts on the activesheet, and no chart needs to be selected:

&lt;pre class=&quot;vbasmall&quot;&gt;Sub ColorByCategoryLabel()
  Dim rPatterns As Range
  Dim iCategory As Long
  Dim vCategories As Variant
  Dim rCategory As Range
  Dim chtob As ChartObject

  Set rPatterns = ActiveSheet.Range(&quot;A1:A4&quot;)
  For Each chtob In ActiveSheet.ChartObjects
    With chtob.Chart.SeriesCollection(1)
      vCategories = .XValues
      For iCategory = 1 To UBound(vCategories)
        Set rCategory = rPatterns.Find(What:=vCategories(iCategory))
        .Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex
      Next
    End With
  Next
End Sub&lt;br /&gt;
&#160;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>The code was written for one chart, the active chart. However, the following will make it work for all charts on the activesheet, and no chart needs to be selected:</p>
<pre class="vbasmall">Sub ColorByCategoryLabel()
  Dim rPatterns As Range
  Dim iCategory As Long
  Dim vCategories As Variant
  Dim rCategory As Range
  Dim chtob As ChartObject

  Set rPatterns = ActiveSheet.Range("A1:A4")
  For Each chtob In ActiveSheet.ChartObjects
    With chtob.Chart.SeriesCollection(1)
      vCategories = .XValues
      For iCategory = 1 To UBound(vCategories)
        Set rCategory = rPatterns.Find(What:=vCategories(iCategory))
        .Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex
      Next
    End With
  Next
End Sub
&nbsp;</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-16455</link>
		<dc:creator>Steven</dc:creator>
		<pubDate>Mon, 20 Jul 2009 14:27:45 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-16455</guid>
		<description>Thanks for your quick reply Jon. I&#039;m afraid I&#039;m no further with this problem though. I tried it with your sample data on the top of this page and the same thing happens. If you try to merge chart 1 &amp; 2 in a bar chart, then only the first serie (chart 1) receives the defined colors. The second serie gets the standard excel color, although the labels refer to the exact same colum. 
I&#039;m sorry if I&#039;m asking stupid questions here but I&#039;m still relatively new at this stuff and rather intimidated by VBA script. I would be extremely happy if I can get this to work though. Any chance of a more noob-proof explanation?
Thanks a million!!

Steven.</description>
		<content:encoded><![CDATA[<p>Thanks for your quick reply Jon. I&#8217;m afraid I&#8217;m no further with this problem though. I tried it with your sample data on the top of this page and the same thing happens. If you try to merge chart 1 &amp; 2 in a bar chart, then only the first serie (chart 1) receives the defined colors. The second serie gets the standard excel color, although the labels refer to the exact same colum.<br />
I&#8217;m sorry if I&#8217;m asking stupid questions here but I&#8217;m still relatively new at this stuff and rather intimidated by VBA script. I would be extremely happy if I can get this to work though. Any chance of a more noob-proof explanation?<br />
Thanks a million!!</p>
<p>Steven.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-16451</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Mon, 20 Jul 2009 12:59:17 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-16451</guid>
		<description>If the label isn&#039;t found in the color range, then rCategory is nothing, so the error comes from the part after the &quot;=&quot;. If you have not selected a chart, thenthe part in front of the &quot;+&quot; would cause a problem, but this error should occur a few lines higher, at &quot;With ActiveChart.SeriesCollection(1)&quot;.</description>
		<content:encoded><![CDATA[<p>If the label isn&#8217;t found in the color range, then rCategory is nothing, so the error comes from the part after the &#8220;=&#8221;. If you have not selected a chart, thenthe part in front of the &#8220;+&#8221; would cause a problem, but this error should occur a few lines higher, at &#8220;With ActiveChart.SeriesCollection(1)&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-16449</link>
		<dc:creator>Steven</dc:creator>
		<pubDate>Mon, 20 Jul 2009 12:14:39 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-16449</guid>
		<description>Hi Jon,

Many thanks for your excellent posts, they have been very helpfull to me. The code works perfectly on simple charts. However, I am trying to use it in a pivot-chart and it does not work properly. I get an error 91 message saying something like: &quot;the objectvariable or blockvariable With is not designated&quot;. (This might be a very poor translation since my excel 2000 is a dutch language version, unfortunately.) The error is in this line:

.Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex

I am not very good with code so I am at a loss as how to fix it. Is there any chance you could help me out with this?

Thanks!

Steven.</description>
		<content:encoded><![CDATA[<p>Hi Jon,</p>
<p>Many thanks for your excellent posts, they have been very helpfull to me. The code works perfectly on simple charts. However, I am trying to use it in a pivot-chart and it does not work properly. I get an error 91 message saying something like: &#8220;the objectvariable or blockvariable With is not designated&#8221;. (This might be a very poor translation since my excel 2000 is a dutch language version, unfortunately.) The error is in this line:</p>
<p>.Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex</p>
<p>I am not very good with code so I am at a loss as how to fix it. Is there any chance you could help me out with this?</p>
<p>Thanks!</p>
<p>Steven.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-16251</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Mon, 13 Jul 2009 19:09:43 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-16251</guid>
		<description>The code I posted does not take into account of any pattern in the cells. You would need to capture the patterns and the two colors that make up the patter:

.Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex
.Points(iCategory).Interior.PatternColorIndex = rCategory.Interior.PatternColorIndex
.Points(iCategory).Interior.Pattern = rCategory.Interior.Pattern

Note: I did not test this code.</description>
		<content:encoded><![CDATA[<p>The code I posted does not take into account of any pattern in the cells. You would need to capture the patterns and the two colors that make up the patter:</p>
<p>.Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex<br />
.Points(iCategory).Interior.PatternColorIndex = rCategory.Interior.PatternColorIndex<br />
.Points(iCategory).Interior.Pattern = rCategory.Interior.Pattern</p>
<p>Note: I did not test this code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samreen</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-16249</link>
		<dc:creator>Samreen</dc:creator>
		<pubDate>Mon, 13 Jul 2009 19:01:15 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-16249</guid>
		<description>I&#039;m having problem with the code and I&#039;m getting an error message on the following line:
.Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex

I&#039;m using black and white patterns for a column chart and there are 25 series.  What should I do to fix this error?

Thanks!</description>
		<content:encoded><![CDATA[<p>I&#8217;m having problem with the code and I&#8217;m getting an error message on the following line:<br />
.Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex</p>
<p>I&#8217;m using black and white patterns for a column chart and there are 25 series.  What should I do to fix this error?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danièle</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-15828</link>
		<dc:creator>Danièle</dc:creator>
		<pubDate>Fri, 03 Jul 2009 01:49:48 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-15828</guid>
		<description>Ok, I figured out what was going wrong with the Axis titles...by checking how the Chart Title was coded. 
I changed the following lines
  With .AxisTitle
                .AutoScaleFont = False
                .Text = &quot;=Sheet1!R2C2&quot;
to 

                .Text = &quot;=&#039;&quot; &amp; ActiveSheet.Name &amp; &quot;&#039;!R2C2&quot;

I first tried 
                .Text = &quot;=&#039;Sheet1&#039;!R2C2&quot;, just adding &quot; &#039; &quot; before and after Sheet1, but that did not work because Sheet1&#039;s name was &quot;Control Chart&quot;.

For the labels odd behaviour... it does not appear any more. One elusive little glitch!

Today I have realised that I am still not capable of writing code efficiently, but just as for a language, I am starting to understand more and more!

For the control charts I was too interested in the code! As the data changed each time,  the changes in the graphs were each time based on the new distribution parameters. 
Thanks again for pointing out that as a control chart for a given distribution, changing the parameters each time a new value is added to the distribution would be incorrect. 

Thanks!
 
Danièle</description>
		<content:encoded><![CDATA[<p>Ok, I figured out what was going wrong with the Axis titles&#8230;by checking how the Chart Title was coded.<br />
I changed the following lines<br />
  With .AxisTitle<br />
                .AutoScaleFont = False<br />
                .Text = &#8220;=Sheet1!R2C2&#8243;<br />
to </p>
<p>                .Text = &#8220;=&#8217;&#8221; &amp; ActiveSheet.Name &amp; &#8220;&#8216;!R2C2&#8243;</p>
<p>I first tried<br />
                .Text = &#8220;=&#8217;Sheet1&#8242;!R2C2&#8243;, just adding &#8221; &#8216; &#8221; before and after Sheet1, but that did not work because Sheet1&#8217;s name was &#8220;Control Chart&#8221;.</p>
<p>For the labels odd behaviour&#8230; it does not appear any more. One elusive little glitch!</p>
<p>Today I have realised that I am still not capable of writing code efficiently, but just as for a language, I am starting to understand more and more!</p>
<p>For the control charts I was too interested in the code! As the data changed each time,  the changes in the graphs were each time based on the new distribution parameters.<br />
Thanks again for pointing out that as a control chart for a given distribution, changing the parameters each time a new value is added to the distribution would be incorrect. </p>
<p>Thanks!</p>
<p>Danièle</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-15826</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Fri, 03 Jul 2009 01:23:41 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-15826</guid>
		<description>In a true control chart, you have to determine your distribution parameters (mean and standard deviation), then lock them in as control limits in the chart. In my example, it implies that these limits are to be recalculated after every subsequent measurement.

Labels sometimes work in a funny way. I&#039;ve sometimes seen the last character, the close parenthesis in your example, displayed in front of the first. Whenever I look closely to try to figure it out, it seems to go away. I don&#039;t know what it is.</description>
		<content:encoded><![CDATA[<p>In a true control chart, you have to determine your distribution parameters (mean and standard deviation), then lock them in as control limits in the chart. In my example, it implies that these limits are to be recalculated after every subsequent measurement.</p>
<p>Labels sometimes work in a funny way. I&#8217;ve sometimes seen the last character, the close parenthesis in your example, displayed in front of the first. Whenever I look closely to try to figure it out, it seems to go away. I don&#8217;t know what it is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danièle</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-15825</link>
		<dc:creator>Danièle</dc:creator>
		<pubDate>Fri, 03 Jul 2009 00:36:59 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-15825</guid>
		<description>Thanks! 
I have been going through the code, and as usual, learning more than I bargained for. You mention that it should not be used as a real control chart? For a neophyte like me, it seemed pretty much a real control chart? So what is missing, or incorrect in the approach?
On another point, despite having found where all the titles are coded in the macro, and seeing the chart correctly labelled on opening the file with all the correct axis titles, I do not understand why when running the macro, the axis titles remain simply &quot;Axis Title&quot; and do not update with the cell as coded?  
The series names on opening the file came as &quot;) UCL (37.4&quot; but when running the macro they appeared correctly as &quot;UCL (37.4)&quot;. Just odd! I am currently using excel 2003. No big problem for what I was after, but I am just curious.... 
Many Thanks, 
Danièle</description>
		<content:encoded><![CDATA[<p>Thanks!<br />
I have been going through the code, and as usual, learning more than I bargained for. You mention that it should not be used as a real control chart? For a neophyte like me, it seemed pretty much a real control chart? So what is missing, or incorrect in the approach?<br />
On another point, despite having found where all the titles are coded in the macro, and seeing the chart correctly labelled on opening the file with all the correct axis titles, I do not understand why when running the macro, the axis titles remain simply &#8220;Axis Title&#8221; and do not update with the cell as coded?<br />
The series names on opening the file came as &#8220;) UCL (37.4&#8243; but when running the macro they appeared correctly as &#8220;UCL (37.4)&#8221;. Just odd! I am currently using excel 2003. No big problem for what I was after, but I am just curious&#8230;.<br />
Many Thanks,<br />
Danièle</p>
]]></content:encoded>
	</item>
</channel>
</rss>
