<?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 Value</title>
	<atom:link href="http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/</link>
	<description>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Wed, 17 Mar 2010 21:17:29 +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-value/comment-page-1/#comment-27077</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Wed, 17 Feb 2010 01:26:56 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-27077</guid>
		<description>Tyler -

If there&#039;s no other chart on the sheet, try the code below. If there are multiple charts, how would the program know which one to change?

&lt;pre class=&quot;vbasmall&quot;&gt;&lt;code&gt;Sub ColorByValue()
  Dim rPatterns As Range
  Dim iPattern As Long
  Dim vPatterns As Variant
  Dim iPoint As Long
  Dim vValues As Variant
  Dim rValue As Range

  Set rPatterns = ActiveSheet.Range(&quot;A1:A4&quot;)
  vPatterns = rPatterns.Value
  &lt;strong&gt;With ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1)&lt;/strong&gt;
    vValues = .Values
    For iPoint = 1 To UBound(vValues)
      For iPattern = 1 To UBound(vPatterns)
        If vValues(iPoint) &lt;= vPatterns(iPattern, 1) Then
          .Points(iPoint).Interior.ColorIndex = _
              rPatterns.Cells(iPattern, 1).Interior.ColorIndex
          Exit For
        End If
      Next
    Next
  End With
End Sub&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Tyler -</p>
<p>If there&#8217;s no other chart on the sheet, try the code below. If there are multiple charts, how would the program know which one to change?</p>
<pre class="vbasmall"><code>Sub ColorByValue()
  Dim rPatterns As Range
  Dim iPattern As Long
  Dim vPatterns As Variant
  Dim iPoint As Long
  Dim vValues As Variant
  Dim rValue As Range

  Set rPatterns = ActiveSheet.Range("A1:A4")
  vPatterns = rPatterns.Value
  <strong>With ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1)</strong>
    vValues = .Values
    For iPoint = 1 To UBound(vValues)
      For iPattern = 1 To UBound(vPatterns)
        If vValues(iPoint) &lt;= vPatterns(iPattern, 1) Then
          .Points(iPoint).Interior.ColorIndex = _
              rPatterns.Cells(iPattern, 1).Interior.ColorIndex
          Exit For
        End If
      Next
    Next
  End With
End Sub</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: tyler</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/comment-page-1/#comment-27051</link>
		<dc:creator>tyler</dc:creator>
		<pubDate>Tue, 16 Feb 2010 15:40:21 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-27051</guid>
		<description>i&#039;m trying to get a button set up so I don&#039;t have to go through the developer tab each time and run the macro, but when I try to do this, i get an error for Object Variable or With block variable not set, so it&#039;s like i&#039;m not clicking on the chart that I want to update. Is there a way that can set up my VBA so that I don&#039;t have to be clicked inside of the chart?</description>
		<content:encoded><![CDATA[<p>i&#8217;m trying to get a button set up so I don&#8217;t have to go through the developer tab each time and run the macro, but when I try to do this, i get an error for Object Variable or With block variable not set, so it&#8217;s like i&#8217;m not clicking on the chart that I want to update. Is there a way that can set up my VBA so that I don&#8217;t have to be clicked inside of the chart?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shane</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/comment-page-1/#comment-27039</link>
		<dc:creator>Shane</dc:creator>
		<pubDate>Tue, 16 Feb 2010 10:33:50 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-27039</guid>
		<description>Thanks for the great info you have on this site, I found some very interesting stuff on here. Sure I will use some of it at some point. 

Regards

Shane</description>
		<content:encoded><![CDATA[<p>Thanks for the great info you have on this site, I found some very interesting stuff on here. Sure I will use some of it at some point. </p>
<p>Regards</p>
<p>Shane</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/comment-page-1/#comment-25741</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Thu, 21 Jan 2010 12:56:27 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-25741</guid>
		<description>Dean -

Good question. I&#039;ve answered it in a new post, &lt;a href=&quot;http://peltiertech.com/WordPress/conditional-xy-charts-without-vba/&quot; title=&quot;Conditional XY Charts Without VBA » PTS Blog&quot; rel=&quot;nofollow&quot;&gt;Conditional XY Charts Without VBA&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Dean -</p>
<p>Good question. I&#8217;ve answered it in a new post, <a href="http://peltiertech.com/WordPress/conditional-xy-charts-without-vba/" title="Conditional XY Charts Without VBA » PTS Blog" rel="nofollow">Conditional XY Charts Without VBA</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dean</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/comment-page-1/#comment-25737</link>
		<dc:creator>Dean</dc:creator>
		<pubDate>Thu, 21 Jan 2010 10:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-25737</guid>
		<description>Hi Jon,

I am looking to color data points based upon the quadrant in which they are present (therefore this is an xy scatter) with the intercept at the average value of x, so therefore the colour will be bases upon 1. a +ve or -ve number on one axis, and 2. the presence above or below the mean of the x axis, any help would be most appreciated

Dean</description>
		<content:encoded><![CDATA[<p>Hi Jon,</p>
<p>I am looking to color data points based upon the quadrant in which they are present (therefore this is an xy scatter) with the intercept at the average value of x, so therefore the colour will be bases upon 1. a +ve or -ve number on one axis, and 2. the presence above or below the mean of the x axis, any help would be most appreciated</p>
<p>Dean</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Peters</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/comment-page-1/#comment-22703</link>
		<dc:creator>Jason Peters</dc:creator>
		<pubDate>Wed, 25 Nov 2009 02:34:21 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-22703</guid>
		<description>oh thanks mate!! that other line ammendment fixed it. really appreciate your help buddy!</description>
		<content:encoded><![CDATA[<p>oh thanks mate!! that other line ammendment fixed it. really appreciate your help buddy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/comment-page-1/#comment-22682</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Tue, 24 Nov 2009 14:55:31 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-22682</guid>
		<description>Jason -

Is the range address in the &lt;tt&gt;vValues =&lt;/tt&gt; statement correct?
Are the values in that range numerical? Text is interpreted as zero.

Did you run this with no error? I should have changed another line:

&lt;pre class=&quot;vbasmall&quot;&gt;    If vValues(iPoint, 1) &lt;= vPatterns(iPattern, 1) Then&lt;/pre&gt;
&lt;p&gt;&#160;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Jason -</p>
<p>Is the range address in the <tt>vValues =</tt> statement correct?<br />
Are the values in that range numerical? Text is interpreted as zero.</p>
<p>Did you run this with no error? I should have changed another line:</p>
<pre class="vbasmall">    If vValues(iPoint, 1) < = vPatterns(iPattern, 1) Then</pre>
<p>&nbsp;</p>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Peters</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/comment-page-1/#comment-22677</link>
		<dc:creator>Jason Peters</dc:creator>
		<pubDate>Tue, 24 Nov 2009 13:54:22 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-22677</guid>
		<description>Hi Jon!

Thanks mate, but the code only seems to colour the graphs with the first colour and ignores all other values with different associated colours. So if my values are

1 = red
2 = yellow
3 = green

The code colours all bars red, even if they have a value of 2 or 3!</description>
		<content:encoded><![CDATA[<p>Hi Jon!</p>
<p>Thanks mate, but the code only seems to colour the graphs with the first colour and ignores all other values with different associated colours. So if my values are</p>
<p>1 = red<br />
2 = yellow<br />
3 = green</p>
<p>The code colours all bars red, even if they have a value of 2 or 3!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/comment-page-1/#comment-22671</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Tue, 24 Nov 2009 11:52:46 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-22671</guid>
		<description>Change the vValues definition to:

&lt;pre class=&quot;vbasmall&quot;&gt;    vValues = Worksheets(&quot;X&quot;).Range(&quot;N1:N100&quot;).Value&lt;/pre&gt;

&#160;
Adjust the address N1:N100 to the range with the values of interest.</description>
		<content:encoded><![CDATA[<p>Change the vValues definition to:</p>
<pre class="vbasmall">    vValues = Worksheets("X").Range("N1:N100").Value</pre>
<p>&nbsp;<br />
Adjust the address N1:N100 to the range with the values of interest.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Peters</title>
		<link>http://peltiertech.com/WordPress/vba-conditional-formatting-of-charts-by-value/comment-page-1/#comment-22664</link>
		<dc:creator>Jason Peters</dc:creator>
		<pubDate>Tue, 24 Nov 2009 07:34:31 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/2008/03/03/vba-conditional-formatting-of-charts-by-value/#comment-22664</guid>
		<description>Hi there,

I want to modify the conditional formatting code by changing teh colour of the graphs not by the value of the bar but by another field.

The values each bar should be coloured is located on another worksheet (Worksheet X) in column N. My question is how do i modify the below code to not take graph values as the colour but take the values in column N on worksheet X.

Sub ColorbyValue()
Dim rPatterns As Range
Dim iPattern As Long
Dim vPatterns As Variant
Dim iPoint As Long
Dim vValues As Variant
Dim rValue As Range
Dim srs As Series

Application.ScreenUpdating = False
Set rPatterns = ActiveSheet.Range(&quot;A1:A6&quot;)
vPatterns = rPatterns.Value

For Each srs In ActiveChart.SeriesCollection
With srs
vValues = .Values
For iPoint = 1 To UBound(vValues)
For iPattern = 1 To UBound(vPatterns)
On Error Resume Next
If vValues(iPoint) &lt;= vPatterns(iPattern, 1) Then
.Points(iPoint).Interior.ColorIndex = _
rPatterns.Cells(iPattern, 1).Interior.ColorIndex
On Error GoTo 0
Exit For
End If
Next
Next
End With
Next
Application.ScreenUpdating = True
End Sub</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>I want to modify the conditional formatting code by changing teh colour of the graphs not by the value of the bar but by another field.</p>
<p>The values each bar should be coloured is located on another worksheet (Worksheet X) in column N. My question is how do i modify the below code to not take graph values as the colour but take the values in column N on worksheet X.</p>
<p>Sub ColorbyValue()<br />
Dim rPatterns As Range<br />
Dim iPattern As Long<br />
Dim vPatterns As Variant<br />
Dim iPoint As Long<br />
Dim vValues As Variant<br />
Dim rValue As Range<br />
Dim srs As Series</p>
<p>Application.ScreenUpdating = False<br />
Set rPatterns = ActiveSheet.Range(&#8220;A1:A6&#8243;)<br />
vPatterns = rPatterns.Value</p>
<p>For Each srs In ActiveChart.SeriesCollection<br />
With srs<br />
vValues = .Values<br />
For iPoint = 1 To UBound(vValues)<br />
For iPattern = 1 To UBound(vPatterns)<br />
On Error Resume Next<br />
If vValues(iPoint) &lt;= vPatterns(iPattern, 1) Then<br />
.Points(iPoint).Interior.ColorIndex = _<br />
rPatterns.Cells(iPattern, 1).Interior.ColorIndex<br />
On Error GoTo 0<br />
Exit For<br />
End If<br />
Next<br />
Next<br />
End With<br />
Next<br />
Application.ScreenUpdating = True<br />
End Sub</p>
]]></content:encoded>
	</item>
</channel>
</rss>
