<?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>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Thu, 18 Mar 2010 18:57:16 +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/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-26895</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Fri, 12 Feb 2010 21:20:30 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-26895</guid>
		<description>Tyler -

Make sure vCategories(iCategory) (the ith X axis label) actually exists in the rPatterns range.</description>
		<content:encoded><![CDATA[<p>Tyler -</p>
<p>Make sure vCategories(iCategory) (the ith X axis label) actually exists in the rPatterns range.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tyler</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-26891</link>
		<dc:creator>tyler</dc:creator>
		<pubDate>Fri, 12 Feb 2010 18:23:25 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-26891</guid>
		<description>I&#039;m trying to adapt this to a pivot chart that i&#039;m making, so i&#039;ve made just a few minor changes, which i hope were correct, but i&#039;m getting the Run time error &#039;91&#039; Object variable with block variable not set, but when i debug i&#039;m getting it for the line &quot;.Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex&quot;


any ideas?
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;H6:H7&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</description>
		<content:encoded><![CDATA[<p>I&#8217;m trying to adapt this to a pivot chart that i&#8217;m making, so i&#8217;ve made just a few minor changes, which i hope were correct, but i&#8217;m getting the Run time error &#8216;91&#8242; Object variable with block variable not set, but when i debug i&#8217;m getting it for the line &#8220;.Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex&#8221;</p>
<p>any ideas?<br />
Sub ColorByCategoryLabel()</p>
<p>Dim rPatterns As Range<br />
Dim iCategory As Long<br />
Dim vCategories As Variant<br />
Dim rCategory As Range<br />
Dim chtob As ChartObject</p>
<p>Set rPatterns = ActiveSheet.Range(&#8220;H6:H7&#8243;)<br />
For Each chtob In ActiveSheet.ChartObjects<br />
With chtob.Chart.SeriesCollection(1)<br />
vCategories = .XValues<br />
For iCategory = 1 To UBound(vCategories)<br />
Set rCategory = rPatterns.Find(What:=vCategories(iCategory))<br />
    .Points(iCategory).Interior.ColorIndex = rCategory.Interior.ColorIndex<br />
Next<br />
End With<br />
Next<br />
End Sub</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-23863</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Sun, 13 Dec 2009 21:46:30 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-23863</guid>
		<description>Jorge -

I see what you were saying, I just didn&#039;t have any code before.

You may get this error because rCategory is undefined, for example, if the category label is not present in the rPatterns range. Make sure everything is spelled the same, including leading and trailing blanks.</description>
		<content:encoded><![CDATA[<p>Jorge -</p>
<p>I see what you were saying, I just didn&#8217;t have any code before.</p>
<p>You may get this error because rCategory is undefined, for example, if the category label is not present in the rPatterns range. Make sure everything is spelled the same, including leading and trailing blanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jorge</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-23856</link>
		<dc:creator>Jorge</dc:creator>
		<pubDate>Sun, 13 Dec 2009 19:27:09 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-23856</guid>
		<description>Hi Jon,

thanks for the quick response. The code that I am using is:

&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;/pre&gt;

&lt;p&gt;&#160;&lt;br /&gt;Which I&#039;ve copied and pasted in VB. I thought with this code you did not need to have any charts selected. 

Despite that I still get the same error: 

Run time error &#039;91&#039;  Object Variable or With block variable not set

I am sure this must be an obvious mistake on my part but for the life of me I cannot see it. Could you please help me out?

Cheers

Jorge</description>
		<content:encoded><![CDATA[<p>Hi Jon,</p>
<p>thanks for the quick response. The code that I am using is:</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</pre>
<p>&nbsp;<br />Which I&#8217;ve copied and pasted in VB. I thought with this code you did not need to have any charts selected. </p>
<p>Despite that I still get the same error: </p>
<p>Run time error &#8216;91&#8242;  Object Variable or With block variable not set</p>
<p>I am sure this must be an obvious mistake on my part but for the life of me I cannot see it. Could you please help me out?</p>
<p>Cheers</p>
<p>Jorge</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-23849</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Sun, 13 Dec 2009 18:27:25 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-23849</guid>
		<description>Jorge -

In the page you&#039;ve cited, the chart has to be selected. Note the line:

With ActiveChart.SeriesCollection(1)</description>
		<content:encoded><![CDATA[<p>Jorge -</p>
<p>In the page you&#8217;ve cited, the chart has to be selected. Note the line:</p>
<p>With ActiveChart.SeriesCollection(1)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jorge</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-category-label/comment-page-1/#comment-23833</link>
		<dc:creator>Jorge</dc:creator>
		<pubDate>Sun, 13 Dec 2009 09:30:15 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-category-label/#comment-23833</guid>
		<description>Hi Jon,

I am trying to use this last version of the code (where no chart needs to be selected) and I keep getting the following error message:

Object Variable or With block variable not set 

I am trying to use it in a spreadsheet identical to the one in your example so no additional complications there. Could you please point me towards the solution?

Thanks,

Jorge</description>
		<content:encoded><![CDATA[<p>Hi Jon,</p>
<p>I am trying to use this last version of the code (where no chart needs to be selected) and I keep getting the following error message:</p>
<p>Object Variable or With block variable not set </p>
<p>I am trying to use it in a spreadsheet identical to the one in your example so no additional complications there. Could you please point me towards the solution?</p>
<p>Thanks,</p>
<p>Jorge</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-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>
</channel>
</rss>
