<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.office.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx</link><description>Since I have had some comments and emails asking about how the new conditional formatting features could be accessed using VBA, I wanted to provide a few brief examples. One of the Excel team’s principles is that when we add new features, we make sure</description><dc:language>en-US</dc:language><generator>Telligent Community 1.5.134.15456 (Build: 5.5.134.15456)</generator><item><title>re: Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8372</link><pubDate>Wed, 19 Oct 2005 17:59:04 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8372</guid><dc:creator>Stephen Bullen</dc:creator><description>&lt;p&gt;David - All the scenarios I can think of are based around doing things according to what (formatting) the user is looking at - wherever that visual display came from or is affected by.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8372" width="1" height="1"&gt;</description></item><item><title>re: Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8373</link><pubDate>Wed, 19 Oct 2005 10:29:37 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8373</guid><dc:creator>Jean-Marc Decouleur</dc:creator><description>&lt;p&gt;David - Definetely yes to include formatting from styles. Thank you.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8373" width="1" height="1"&gt;</description></item><item><title>re: Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8374</link><pubDate>Wed, 19 Oct 2005 04:45:50 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8374</guid><dc:creator>David Gainer</dc:creator><description>&lt;p&gt;Greetings everyone. &amp;nbsp;Thanks for the clarification and additional feedback. &amp;nbsp;Sounds like there are two scenarios - one that requires simply knowing whether a condition is true or false, and a second that describes the end formatting. &amp;nbsp;Curious - would that include formatting from styles (will be much more prominent this release) and server formatting (in the case the cell is getting its data from something like Analysis Server)?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8374" width="1" height="1"&gt;</description></item><item><title>re: Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8375</link><pubDate>Tue, 18 Oct 2005 17:21:25 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8375</guid><dc:creator>Stephen Bullen</dc:creator><description>&lt;p&gt;Jim - Yes, assuming that ConditionInEffect is a composite of all &amp;#39;on&amp;#39; conditions (as we can have multiple on at one time). So if one condition set the font bold, another put a blue background and a third made the text yellow, the ConditionInEffect would return a FormatCondition object that had Font=Yellow Bold, Interior.Color=Blue. That&amp;#39;d work really well if it started off with the range&amp;#39;s default formatting and overwrote the bits changed by each condition.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8375" width="1" height="1"&gt;</description></item><item><title>re: Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8376</link><pubDate>Tue, 18 Oct 2005 14:30:47 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8376</guid><dc:creator>Jim Rech</dc:creator><description>&lt;p&gt;David, Stephen-&lt;/p&gt;
&lt;p&gt;This would address my needs I think:&lt;/p&gt;
&lt;p&gt;Dim ActiveCondition as FormatCondition&lt;/p&gt;
&lt;p&gt;Set ActiveCondition= Rg.FormatConditions.ConditionInEffect&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8376" width="1" height="1"&gt;</description></item><item><title>re: Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8377</link><pubDate>Tue, 18 Oct 2005 11:34:23 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8377</guid><dc:creator>Stephen Bullen</dc:creator><description>&lt;p&gt;David - There are quite a lot of situations where we want to be able to determine using VBA what is actually presented to the user, such as a UDF to perform calculations based on colour, font style etc (e.g. &amp;quot;Sum of Red cells&amp;quot;). In Excel 2003, we have to iterate through the conditions, evaluate them to see if they&amp;#39;re active (which is not easy if they&amp;#39;re using relative formulae) and then see if they set the background colour to Red. In Excel 12, we&amp;#39;d also have to see if there are multiple conditions that evaluate to True, try to remember which has precedence (first or last?) etc. It&amp;#39;s extremely frustrating to see that Excel must have already done the evaluation to know what to display, but that isn&amp;#39;t presented in the object model. Hence the need/request for a Range.VisibleFormat property, which will return the formatting that the user is actually seeing (regardless of whether that came from the range&amp;#39;s base formatting or conditional formatting).&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8377" width="1" height="1"&gt;</description></item><item><title>What about charts?</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8378</link><pubDate>Tue, 18 Oct 2005 11:28:06 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8378</guid><dc:creator>Helen</dc:creator><description>&lt;p&gt;Agree, a FormatCondition.Evaluate method (which would return True or False) would be very handy.&lt;/p&gt;
&lt;p&gt;In the past I&amp;#39;ve needed to read the conditional formatting of a range (evaluate the conditions, find the active condition, get its format) in ordre to &amp;quot;conditionally&amp;quot; format a chart or a shape. Sometimes it&amp;#39;s possible to do the chart formatting by using separate series for the different conditions, but not always. If Excel12 supported conditional formatting of charts, then most of those cases would no longer need a VBA solution.&lt;/p&gt;
&lt;p&gt;Shapes will always require a VBA solution, of course.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8378" width="1" height="1"&gt;</description></item><item><title>re: Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8379</link><pubDate>Tue, 18 Oct 2005 01:25:21 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8379</guid><dc:creator>David Gainer</dc:creator><description>&lt;p&gt;Greetings&lt;/p&gt;
&lt;p&gt;Juan Pablo, Harlan – thanks for the feedback. &amp;nbsp;Currently, you would have to do this by iterating through the conditions as Harlan suggested. &amp;nbsp;What sort of scenarios require you to check for the active conditional format?&lt;/p&gt;
&lt;p&gt;Stephen - Correct, Range.Interior.Color does not give the conditional formatting color. Instead, you can use the Interior.Color property on the FormatConditions object like: ?ActiveCell.FormatConditions(1).Interior.Color … this will get you the color of the cell based on the conditional formatting rule.&lt;/p&gt;
&lt;p&gt;Lenie - Is this a question about XLM support in general? &amp;nbsp;If so, yes, XLM will be supported in Excel 12. &lt;/p&gt;
&lt;p&gt;Mike – The specific examples I gave are all Excel 12 only, as earlier versions of Excel don’t support this data bars, top 10, or re-ordering conditions. &amp;nbsp;The FormatConditions collection does exist in Excel 97 – Excel 2003, so you can programmatically work with the conditional formatting functionality available in those versions.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8379" width="1" height="1"&gt;</description></item><item><title>re: Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8380</link><pubDate>Mon, 17 Oct 2005 17:18:34 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8380</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;will this work in excel 2002?&lt;/p&gt;
&lt;p&gt;i&amp;#39;m getting an error:&lt;/p&gt;
&lt;p&gt;runtime error &amp;#39;438&amp;#39;&lt;/p&gt;
&lt;p&gt;object doesn&amp;#39;t support this property or method&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8380" width="1" height="1"&gt;</description></item><item><title>re: Conditional formatting using VBA - some examples</title><link>http://blogs.office.com/b/microsoft-excel/archive/2005/10/14/conditional-formatting-using-vba-some-examples.aspx#8381</link><pubDate>Mon, 17 Oct 2005 11:10:32 GMT</pubDate><guid isPermaLink="false">53587256-c606-4c9b-bad4-97c86b12ce62:8381</guid><dc:creator>Lenie Hobo</dc:creator><description>&lt;p&gt;How about the XLM (macro-) support. Is it in-or-out in this version of Excel. I&amp;#39;am curious ... &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.office.com/aggbug.aspx?PostID=8381" width="1" height="1"&gt;</description></item></channel></rss>