<?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: Change a Cells Background Color</title>
	<atom:link href="http://www.automateexcel.com/2004/09/22/excel_vba_change_a_cells_background_colo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.automateexcel.com/2004/09/22/excel_vba_change_a_cells_background_colo/</link>
	<description>Everything Excel. Only Excel.</description>
	<lastBuildDate>Mon, 21 Nov 2011 07:25:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Gordon</title>
		<link>http://www.automateexcel.com/2004/09/22/excel_vba_change_a_cells_background_colo/comment-page-1/#comment-1145</link>
		<dc:creator>Gordon</dc:creator>
		<pubDate>Tue, 10 Feb 2009 20:11:04 +0000</pubDate>
		<guid isPermaLink="false">#comment-1145</guid>
		<description>@Mac Chris

You start off defining a subroutine (Sub) and end up closing a function.  This alone will not work.

You appear to be expecting to loop through a range of cells, but there is no code to do this.

Following your logic, is something like this what you were trying to achieve?

Sub changeBackColor()
    Dim x As Long
    
    For x = 0 To 55
        If x = 10 Then
            Sheets(&quot;Sheet1&quot;).Range(&quot;A1&quot;).Offset(x, 0).Interior.ColorIndex = 3
        Else
            Sheets(&quot;Sheet1&quot;).Range(&quot;A1&quot;).Offset(x, 0).Interior.ColorIndex = 11
        End If
    Next x
End Sub</description>
		<content:encoded><![CDATA[<p>@Mac Chris</p>
<p>You start off defining a subroutine (Sub) and end up closing a function.  This alone will not work.</p>
<p>You appear to be expecting to loop through a range of cells, but there is no code to do this.</p>
<p>Following your logic, is something like this what you were trying to achieve?</p>
<p>Sub changeBackColor()<br />
    Dim x As Long</p>
<p>    For x = 0 To 55<br />
        If x = 10 Then<br />
            Sheets(&#8220;Sheet1&#8243;).Range(&#8220;A1&#8243;).Offset(x, 0).Interior.ColorIndex = 3<br />
        Else<br />
            Sheets(&#8220;Sheet1&#8243;).Range(&#8220;A1&#8243;).Offset(x, 0).Interior.ColorIndex = 11<br />
        End If<br />
    Next x<br />
End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mac Chris</title>
		<link>http://www.automateexcel.com/2004/09/22/excel_vba_change_a_cells_background_colo/comment-page-1/#comment-1135</link>
		<dc:creator>Mac Chris</dc:creator>
		<pubDate>Thu, 29 Jan 2009 15:38:58 +0000</pubDate>
		<guid isPermaLink="false">#comment-1135</guid>
		<description>the sub (macro) is perfect
but the function goes failed!
WHY???

Sub ColorRef()
Dim x As Integer

For x = 1 To 56

If x  10 Then
    CurrentCell.Interior.ColorIndex = 3
Else
    CurrentCell.Interior.ColorIndex = 11
End If
End Function</description>
		<content:encoded><![CDATA[<p>the sub (macro) is perfect<br />
but the function goes failed!<br />
WHY???</p>
<p>Sub ColorRef()<br />
Dim x As Integer</p>
<p>For x = 1 To 56</p>
<p>If x  10 Then<br />
    CurrentCell.Interior.ColorIndex = 3<br />
Else<br />
    CurrentCell.Interior.ColorIndex = 11<br />
End If<br />
End Function</p>
]]></content:encoded>
	</item>
</channel>
</rss>

