<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Ken Puls Blog &#187; Excel</title>
	<atom:link href="http://www.excelguru.ca/blog/category/excel/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.excelguru.ca/blog</link>
	<description>More geeky stuff from the author of www.excelguru.ca...</description>
	<lastBuildDate>Fri, 03 Sep 2010 04:49:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Enabling Outlining Commands on a Protected Worksheet</title>
		<link>http://www.excelguru.ca/blog/2010/09/01/enabling-outlining-commands-on-a-protected-worksheet/</link>
		<comments>http://www.excelguru.ca/blog/2010/09/01/enabling-outlining-commands-on-a-protected-worksheet/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 07:18:15 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[I hate it when...]]></category>
		<category><![CDATA[Office 2010]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2010/09/01/enabling-outlining-commands-on-a-protected-worksheet/</guid>
		<description><![CDATA[I have a financial model that I set up using a grouping in some key places so that I could collapse sections of the model when I didn&#8217;t want to look at them.  As I was handing off the model to someone else to work with, I wanted to protect the worksheets, but unfortunately [...]]]></description>
			<content:encoded><![CDATA[<p>I have a financial model that I set up using a grouping in some key places so that I could collapse sections of the model when I didn&#8217;t want to look at them.  As I was handing off the model to someone else to work with, I wanted to protect the worksheets, but unfortunately there is no setting in the user interface to allow for expanding/collapsing the outlining tools when the sheet is protected.  In fact, trying to do so gives you the following message:
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2010/09/090210_0718_EnablingOut1.png" alt=""/>
	</p>
<p>I found this a little frustrating, but gave up on it.  I expanded the model completely, protected the sheets and let the users have at &#8216;er.
</p>
<p>Tonight at VBAExpress.com though, I was posting on a thread where the user had included the following in their code:
</p>
<p style="margin-left: 36pt"><span style="color:black"><em>Sh.EnableOutlining = <span style="color:blue">True<br />
</span></em></span></p>
<p><span style="color:black">Wow!  So obviously there IS a way to enable the outlining tools when the worksheet is protected, right?  I ran the macro I had modified for the user and sure enough it worked.  Cool!<br />
</span></p>
<p><span style="color:black">So then I opened up a copy of my model and:<br />
</span></p>
<ul style="margin-left: 54pt">
<li>Ran the following code:  <em>Activesheet.EnableOutlining = True</em>
		</li>
<li>Protected the worksheet
</li>
</ul>
<p>I didn&#8217;t work.  What the hell?
</p>
<p>After a little sleuthing I found out what the issue was.  In order for the EnableOutlining to take effect, you must run the code that protects your worksheet with the userinterfaceonly:=true argument.
</p>
<p>The unfortunate part of this is that userinterfaceonly:=true doesn&#8217;t stick between sessions.  So that nice macro free workbook is now going to have to be saved into an xlsm format with the following code in it:
</p>
<p style="margin-left: 36pt"><em>Private Sub Workbook_Open()<br />
</em></p>
<p style="margin-left: 36pt"><em>    Dim ws As Worksheet<br />
</em></p>
<p style="margin-left: 36pt">
 </p>
<p style="margin-left: 36pt"><em>    Application.ScreenUpdating = False<br />
</em></p>
<p style="margin-left: 36pt"><em>    For Each ws In ThisWorkbook.Worksheets<br />
</em></p>
<p style="margin-left: 36pt"><em>        With ws<br />
</em></p>
<p style="margin-left: 36pt"><em>            .Protect userinterfaceonly:=True<br />
</em></p>
<p style="margin-left: 36pt"><em>            .EnableOutlining = True<br />
</em></p>
<p style="margin-left: 36pt"><em>        End With<br />
</em></p>
<p style="margin-left: 36pt"><em>    Next ws<br />
</em></p>
<p style="margin-left: 36pt"><em>    Application.ScreenUpdating = True<br />
</em></p>
<p style="margin-left: 36pt"><em>End Sub<br />
</em></p>
<p>
 </p>
<p>That shouldn&#8217;t be necessary in my opinion, but whatever. A macro laden file is a small price to pay for the functionality.  Man I love VBA!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2010/09/01/enabling-outlining-commands-on-a-protected-worksheet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Macro to wrap an existing formula with IFERROR</title>
		<link>http://www.excelguru.ca/blog/2010/08/27/macro-to-wrap-an-existing-formula-with-iferror/</link>
		<comments>http://www.excelguru.ca/blog/2010/08/27/macro-to-wrap-an-existing-formula-with-iferror/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 21:17:34 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Office 2007]]></category>
		<category><![CDATA[Office 2010]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2010/08/27/macro-to-wrap-an-existing-formula-with-iferror/</guid>
		<description><![CDATA[Today I realized that one of my GETPIVOTDATA formulas was returning an error, since there wasn&#8217;t any result in the Pivot Table it was checking for data.  Unfortunately, during the design of the spreadsheet I never wrapped the function with IFERROR to avoid this.

The challenge I had was that I had several different formulas [...]]]></description>
			<content:encoded><![CDATA[<p>Today I realized that one of my GETPIVOTDATA formulas was returning an error, since there wasn&#8217;t any result in the Pivot Table it was checking for data.  Unfortunately, during the design of the spreadsheet I never wrapped the function with IFERROR to avoid this.
</p>
<p>The challenge I had was that I had several different formulas that needed to be wrapped, and didn&#8217;t want to spend the time adjusting each one manually.  So I wrote a little macro to adjust the existing formulas.   Basically what this does it checks each cell in the selection and, if it has a formula in it, wraps it within the following construct:  <strong>=IFERROR(<em>existing formula</em>, 0)</strong>  The point?  Now if an error is returned, it will return 0 instead.
</p>
<p>Public Sub WrapWithIfError()
</p>
<p>    Dim cl As Range
</p>
<p>
 </p>
<p>    For Each cl In Selection
</p>
<p>        If cl.HasFormula Then _
</p>
<p>           cl.Formula = &#8220;=IFERROR(&#8221; &amp; Right(cl.Formula, Len(cl.Formula) &#8211; 1) &amp; &#8220;,0)&#8221;
</p>
<p>    Next cl
</p>
<p>End Sub
</p>
<p>Just a heads up here though… you&#8217;ll need Excel 2007 or later to make use of the IFERROR function.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2010/08/27/macro-to-wrap-an-existing-formula-with-iferror/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Built in Ribbon Customizations in Office 2010</title>
		<link>http://www.excelguru.ca/blog/2010/05/24/built-in-ribbon-customizations-in-office-2010/</link>
		<comments>http://www.excelguru.ca/blog/2010/05/24/built-in-ribbon-customizations-in-office-2010/#comments</comments>
		<pubDate>Tue, 25 May 2010 06:05:07 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[I hate it when...]]></category>
		<category><![CDATA[Office 2010]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2010/05/24/built-in-ribbon-customizations-in-office-2010/</guid>
		<description><![CDATA[I know it&#8217;s been forever since I&#8217;ve blogged here, and I&#8217;m sorry to have to revive this with a rant, but…
I was writing an article up for how to customize the Office Ribbon in Excel 2010, and thought I&#8217;d build a custom Auditing Tab. Using the built in groups is REALLY easy, but there were [...]]]></description>
			<content:encoded><![CDATA[<p>I know it&#8217;s been forever since I&#8217;ve blogged here, and I&#8217;m sorry to have to revive this with a rant, but…</p>
<p>I was writing an article up for how to customize the Office Ribbon in Excel 2010, and thought I&#8217;d build a custom Auditing Tab. Using the built in groups is REALLY easy, but there were commands there I didn&#8217;t need. So I figured that I&#8217;d try to make some custom groups, insert the commands I wanted, and see how it worked. Even better, I know that you can now export the customizations, so I could even share them!</p>
<p>To build a custom Ribbon tab:</p>
<ul>
<li>Right click the Ribbon and choose &#8220;Customize Ribbon&#8221;, or go to File<span style="font-family: Wingdings;">à</span>Excel Options<span style="font-family: Wingdings;">à</span>Customize Ribbon.</li>
<li>Click New Tab</li>
<li>Select the tab and choose Rename</li>
<li>Go to the &#8220;Choose commands from&#8221; dropdown and choose Main Tabs</li>
<li>Find the groups you like, select them and click the Add&gt;&gt; button</li>
</ul>
<p>To add a new group to a tab, first select the tab then:</p>
<ul>
<li>Click New Group</li>
<li>Select the group and choose Rename</li>
<li>Drill down to the commands you like (left window), select them and click the Add&gt;&gt; button</li>
</ul>
<p>Overall it&#8217;s not too complicated really.</p>
<p>So here&#8217;s the setup I did for my Auditing Tab… (I shrunk it so that you only see stuff pertaining to that tab):</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2010/05/052510_0605_BuiltinRibb1.png" alt="" /></p>
<p>As you can see, I created custom Formula Auditing, Other Tools and Sort &amp; Filter groups. (I don&#8217;t know why I use the default Sort &amp; Filter as well a custom one, but there you have it. At any rate, it doesn&#8217;t change this… the tab looks like crap!</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2010/05/052510_0605_BuiltinRibb2.png" alt="" /></p>
<p>The icons for Trace Precedents, Trace Dependents and Remove Arrows are all large and very blocky looking. Same with the Sort buttons on the custom group. Why is it that they are shown nice and small on the built in group, but not the custom one? And isn&#8217;t it interesting how Microsoft broke the 1 or 3 to a row rule with the Sort group? Makes it very obvious here!</p>
<p>If you want the customization file to try this yourself, click <a href="http://www.excelguru.ca/files/CustomAuditing.exportedUI" target="_self">here</a>.</p>
<p>Personally, I&#8217;m happy enough with the way the built-in groups work, but I think there should have been a bit more control on the sizing of the icons here. It seems that the need for my book (<a href="http://www.excelguru.ca/node/93">RibbonX – Customizing the Office 2007 Ribbon</a>) isn&#8217;t dead yet, but honestly, it should be!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2010/05/24/built-in-ribbon-customizations-in-office-2010/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>New article on the site</title>
		<link>http://www.excelguru.ca/blog/2009/10/14/new-article-on-the-site/</link>
		<comments>http://www.excelguru.ca/blog/2009/10/14/new-article-on-the-site/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 05:15:14 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/10/14/new-article-on-the-site/</guid>
		<description><![CDATA[Over the past… ages… it seems like I haven&#8217;t been able to my site, but I got a new article up today.  It&#8217;s a variation on my Count Files (with a specific extension or not) in a folder entry.  It doesn&#8217;t seem at first like a big departure, but I&#8217;ve posted a version [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past… ages… it seems like I haven&#8217;t been able to my site, but I got a new article up today.  It&#8217;s a variation on my <a href="http://www.excelguru.ca/node/96">Count Files (with a specific extension or not) in a folder</a> entry.  It doesn&#8217;t seem at first like a big departure, but I&#8217;ve posted a version now that will also count files in both the folder and subfolders.  It was an easy fix, requested by a reader.  The big difference is really that it uses recursion to keep calling itself to dig deeper in the folder structure to get the info.
</p>
<p>At any rate, if you&#8217;re interested, you can find it here: <a href="http://www.excelguru.ca/node/106">http://www.excelguru.ca/node/106</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/10/14/new-article-on-the-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A reader’s question on Application.Run</title>
		<link>http://www.excelguru.ca/blog/2009/09/03/a-reader%e2%80%99s-question-on-applicationrun/</link>
		<comments>http://www.excelguru.ca/blog/2009/09/03/a-reader%e2%80%99s-question-on-applicationrun/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 15:15:10 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/09/03/a-reader%e2%80%99s-question-on-applicationrun/</guid>
		<description><![CDATA[Dave writes:
I found your excellent code to run a procedure on a target spreadsheet from
an originating spreadsheet on VB Express Forum.  It works fine if both
files are on the same jump drive but fails on our work network and even if
the originating file is in Documents on my home computer.  Is there any
security setting that [...]]]></description>
			<content:encoded><![CDATA[<p>Dave writes:</p>
<p style="margin-left: 36pt"><em>I found your excellent code to run a procedure on a target spreadsheet from<br />
an originating spreadsheet on VB Express Forum.  It works fine if both<br />
files are on the same jump drive but fails on our work network and even if<br />
the originating file is in Documents on my home computer.  Is there any<br />
security setting that you can think of that would cause this to happen?<br />
</em></p>
<p>For others following along, the source KB entry (you may need to create FREE login to get it) can be found at <a href="http://www.vbaexpress.com/kb/getarticle.php?kb_id=279">http://www.vbaexpress.com/kb/getarticle.php?kb_id=279</a></p>
<p>With regards to the security question, it would depend if this is an Office 2007/2010 instance.  If so, then the folders where the target spreadsheets reside would need to be included in the &#8220;Trusted Locations&#8221;.  (Office button<span style="font-family: Wingdings">-></span>Excel Options<span style="font-family: Wingdings">-></span>Trust Center<span style="font-family: Wingdings"><span style="font-family: Wingdings">-></span>Trust Center Settings<span style="font-family: Wingdings">-></span>Trusted Locations.)</span></p>
<p>If this is a version of Excel prior to 2007, I can&#8217;t think of anything that would be a security concern to prevent this.  One thing that could potentially be an issue is using UNC paths instead of mapped drives, but I haven&#8217;t tested that to be sure.</p>
<p>I can say that I use a variant of this macro every month to roll forward 12 inventory files in one shot.  The source and the destination workbooks all reside on our network, but in different drives.  The key parts of this:</p>
<p>sRollMacro = &#8220;&#8216;2009-07-31 16030-900 (Hotel Beverage).xls&#8217;!InventoryRollForward_Liquor&#8221;<br />
Workbooks.Open (ThisWorkbook.Worksheets(&#8220;Master&#8221;).Range(&#8220;rngSourcePath&#8221;) &#038; _<br />
&#8220;2009-07-31 16030-900 (Hotel Beverage).xls&#8221;)<br />
Application.Run (sRollMacro)</p>
<p>I first used this in Excel 97, and it still works in 2007 today.  (Haven&#8217;t tested it in the 2010 beta yet, but I will in a few days.)Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/09/03/a-reader%e2%80%99s-question-on-applicationrun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lie Back and Think of England</title>
		<link>http://www.excelguru.ca/blog/2009/08/08/lie-back-and-think-of-england/</link>
		<comments>http://www.excelguru.ca/blog/2009/08/08/lie-back-and-think-of-england/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 16:21:53 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/08/08/lie-back-and-think-of-england/</guid>
		<description><![CDATA[My sister-in-laws&#8217;s status on Facebook this morning:  &#8220;Francine Street is wondering what to do today&#8221;


	
Hopefully Francine gets the joke…

Personally, I will be lying back and thinking of England.  (For real, not like this.)  Although I haven&#8217;t made much public mention of this yet, in 8 hours I&#8217;ll to be on a plane [...]]]></description>
			<content:encoded><![CDATA[<p>My sister-in-laws&#8217;s status on Facebook this morning:  &#8220;Francine Street is wondering what to do today&#8221;
</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/08/080809_1621_LieBackandT1.png" alt=""/>
	</p>
<p>Hopefully Francine gets the joke…
</p>
<p>Personally, I will be lying back and thinking of England.  (For real, <a href="http://en.wikipedia.org/wiki/Lie_back_and_think_of_England">not like this</a>.)  Although I haven&#8217;t made much public mention of this yet, in 8 hours I&#8217;ll to be on a plane on my way to London.
</p>
<p>We actually have a pretty large number of family all over England.  My dad has two brothers and a sister, all of whom have 2 kids each, some of whom have kids.  With the exception of my immediate family and one cousin, (who lives in Japan,) all of them make their home somewhere in the UK.  And that doesn&#8217;t cover my mom&#8217;s side who naturally factor in there too.  And while the bulk of mom&#8217;s immediate family is in one place, she&#8217;s got close cousins scattered across the country.  Naturally, we&#8217;re going to be visiting as many of them (on both sides) as we can, and we&#8217;re doing the grand tour of the UK to do it.  And when I say the grand tour, I mean it… check this out:
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/08/080809_1621_LieBackandT2.png" alt=""/>
	</p>
<p>We fly into London, stay a couple of days in Romford, then head on to Nottingham, Edinburgh, and Inverness.  Then back down through the Lakes District to Coventry, and west to Newport for a few days.  Why Newport?  Well&#8230; it&#8217;s the reason for the whole trip.  August 19, 2009 marks my grandparents 70<sup>th</sup> wedding anniversary and on the 22<sup>nd</sup> Granddad turns 96.  The entire Puls family, with the exception of only my brother, will be coming together to celebrate.  It will be quite the event.
</p>
<p>Now, from the &#8220;I can&#8217;t believe how small this world is&#8221; book, it turns out that Roger Govier lives all of about 20 miles from Granny &amp; Grandad.  And during our four day stretch, we have a day off so we&#8217;ve got the chance to hook up with Roger, who is going to give us the local&#8217;s tour of Cardiff.  Dee and I are quite looking forward to being able to go out and spend the day with a friend, something we&#8217;re not going to have nearly enough opportunities to do.
</p>
<p>Our next stop after Newport is to head down to Poole, where we&#8217;ll be staying for 3 days.  Now there&#8217;s something funny about Poole, and I&#8217;m sure there&#8217;s a comment coming about this…  <img src='http://www.excelguru.ca/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   Pretty much all of my mom&#8217;s immediate family live in Poole, as does our great friend Bob Phillips.  Nick Hodge isn&#8217;t too far away from there, and nor is Richard Schollar.  So there seems to be some kind of gravitational pull about Poole for some reason.  Bob has graciously offered to host us while we&#8217;re there, as there&#8217;s not enough beds with family, and is going to show us what makes Poole the centre of the universe.  <img src='http://www.excelguru.ca/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
<p>After Poole we head back to Romford, and have the opportunity to head into London for a day of sightseeing before we have to head home.
</p>
<p>So now, for the disappointing part…
</p>
<p>I have friends all over England/Scotland and, as I mentioned at the top, I&#8217;ve been pretty silent on my trip till now… As I think everyone can see, we have tons of family to see, many of whom we&#8217;re only going to get to see for one night.  The trip is going to be a hectic one to say the least.  So if you haven&#8217;t received an email from me, please don&#8217;t be offended by it… it&#8217;s not personal at all, just survival.  I&#8217;d like to see all of my friends, many of whom I&#8217;ve never had the chance to meet in person, but time just doesn&#8217;t afford me that luxury.
</p>
<p>At this point it&#8217;s looking a lot like we&#8217;ve got one opportunity to get together with friends… dinner on August 28<sup>th</sup> in London.  If you can make it to London, please drop me a line and we&#8217;ll see if we can hook up.  <img src='http://www.excelguru.ca/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
<p>Last but not least, I also would like to throw out a big &#8220;Thank You!&#8221; to my buddy Ted who will be house-sitting for us while we&#8217;re gone.  Much appreciated, buddy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/08/08/lie-back-and-think-of-england/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Using getSize with RibbonX buttons</title>
		<link>http://www.excelguru.ca/blog/2009/08/04/using-getsize-with-ribbonx-buttons/</link>
		<comments>http://www.excelguru.ca/blog/2009/08/04/using-getsize-with-ribbonx-buttons/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 04:58:34 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Office 2007]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/08/04/using-getsize-with-ribbonx-buttons/</guid>
		<description><![CDATA[A friend just asked for some help with making a getSize callback work with some buttons.  I figured this should be an easy one, and dove into the RibbonX book to check the table on page 172.  Aha!  There it is in the middle of the table:



Static Attribute
Dynamic Attribute
Allowed Values
Default Value
VBA Callback [...]]]></description>
			<content:encoded><![CDATA[<p>A friend just asked for some help with making a getSize callback work with some buttons.  I figured this should be an easy one, and dove into the RibbonX book to check the table on page 172.  Aha!  There it is in the middle of the table:</p>
<div style="margin-left: 30pt">
<table border="0" style="border-collapse: collapse">
<tr style="background: #4f81bd none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
<td style="border-top: 1pt solid #4f81bd; border-left: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>Static Attribute</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>Dynamic Attribute</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>Allowed Values</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>Default Value</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><span style="color: white"><strong>VBA Callback Signature For Dynamic Attribute</strong></span></td>
</tr>
<tr>
<td style="border-top: medium none; border-left: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><strong>size</strong></td>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">getSize</td>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">normal, large</td>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">normal</td>
<td style="border-top: medium none; border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">Sub GetSize (Control as IRibbonControl, ByRef returnedVal</td>
</tr>
</table>
</div>
<p>So I whipped up a quick example to prove it out and… wtf?  I started getting an error message:</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/08/080509_0458_UsinggetSiz1.png" /></p>
<p>Interesting… it returned a value that could not be converted to the expected type.  What the heck is that about?</p>
<p>When you set up your XML code, you use normal or large in the code.  So far as I know, they are the only allowed values, although I can&#8217;t say I tested that.  What I did test, however is both normal and large in VBA callbacks.  Both return the error listed above.</p>
<p>Interestingly enough, I decided to try passing a value of 0 or 1 to the callback via VBA and it worked!  So then I gave it a whirl with true and false.  Likewise, it worked.</p>
<p>So it looks like, in order to use a getSize callback with a button, you actually need to pass one of the following to the callback:</p>
<div style="margin-left: 30pt">
<table border="0" style="border-collapse: collapse">
<tr style="background: #4f81bd none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
<td style="border-top: 1pt solid #4f81bd; border-left: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px" rowspan="2"><span style="color: white"><strong>For</strong></span></td>
<td style="border-top: 1pt solid #4f81bd; border-right: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px" colspan="2">
<p style="text-align: center"><span style="color: white"><strong>Use</strong></span></p>
</td>
</tr>
<tr>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">Either</p>
</td>
<td style="border-top: medium none; border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">Or</p>
</td>
</tr>
<tr>
<td style="border-left: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><strong>normal</strong></td>
<td style="border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">0</p>
</td>
<td style="border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">False</p>
</td>
</tr>
<tr>
<td style="border-top: medium none; border-left: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px"><strong>large</strong></td>
<td style="border-top: medium none; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">1</p>
</td>
<td style="border-top: medium none; border-right: 1pt solid #4f81bd; border-bottom: 1pt solid #4f81bd; padding-left: 7px; padding-right: 7px">
<p style="text-align: center">True</p>
</td>
</tr>
</table>
</div>
<p>Just in case anyone wants to have a play with this, I&#8217;ve also attached a workbook here: <a id="p362" href="http://www.excelguru.ca/blog/wp-content/uploads/2009/08/getsize.zip">getsize.zip</a>.  It also shows how to use getLabel on a tab, as well as getImage on a button.  (It&#8217;s in a zip file, so you&#8217;ll need to unzip it first as my blog won&#8217;t accept xlsm uploads.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/08/04/using-getsize-with-ribbonx-buttons/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Find and Replace Dreams</title>
		<link>http://www.excelguru.ca/blog/2009/07/31/find-and-replace-dreams/</link>
		<comments>http://www.excelguru.ca/blog/2009/07/31/find-and-replace-dreams/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 22:20:12 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/07/31/find-and-replace-dreams/</guid>
		<description><![CDATA[Is it just me, or if the Find and Replace tool in Excel (actually in Office) really limited?


	
The first deficiency is that I want to be able to select &#8220;Within Selection&#8221;, not within &#8220;Sheet&#8221;.  I know that it defaults to the selection if you try this on a multi-cell selection, but if you want [...]]]></description>
			<content:encoded><![CDATA[<p>Is it just me, or if the Find and Replace tool in Excel (actually in Office) really limited?
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/073109_2220_FindandRepl1.png" alt=""/>
	</p>
<p>The first deficiency is that I want to be able to select &#8220;Within Selection&#8221;, not within &#8220;Sheet&#8221;.  I know that it defaults to the selection if you try this on a multi-cell selection, but if you want to replace references in a single formula in a single cell… watch out!  I usually copy my formula to notepad and do the work there.
</p>
<p>Now, the options above are fine for really simple find/replace scenarios, and have served us well for years, I suppose.  Yet it still leaves me wanting, especially right now.  Consider this formula:
</p>
<p>=ROUND($D$69*(SUM($AG66,$E66:AQ66)+SUM($AG93,$E93:AQ93)+SUM($AG120,$E120:AQ120)+SUM($AG157,$E157:AQ157)-SUM($AG163,$E163:AQ163))/SUM($AV$66,$AV$93,$AV$120,$AV$157,-$AV$163)-SUM($AG69,$E69:AP69),0)
</p>
<p>It&#8217;s pretty hideous, but I need to modify it to read as follows:
</p>
<p>=ROUND($D$69*(SUM($AP66:AQ66)+SUM($AP93:AQ93)+SUM($AP120:AQ120)+SUM($AP157:AQ157)-SUM($AP163:AQ163))/SUM($AV$66,$AV$93,$AV$120,$AV$157,-$AV$163)-SUM($AP69:AP69),0)
</p>
<p>So pretty much, what I need to do is
</p>
<ul>
<li>Replace all the $AG references with $AP
</li>
<li>Get rid of the ,$E##? pieces
</li>
</ul>
<p>The existing tools works fine for the first part, but can&#8217;t do the second since the ## pieces change.
</p>
<p>Wouldn&#8217;t it be nice if Excel had pattern matching?  I&#8217;d love to be able to knock up a search to check for a pattern like <strong>comma dollar E number number [number] colon</strong> and replace it with a colon.
</p>
<p>Even though this might seem a little strange to have a variable pattern here, I&#8217;m pretty sure that you can do exactly this with Regular Expressions, and quite quickly too.
</p>
<p>What do you think?  Something you could see value in?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/07/31/find-and-replace-dreams/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Excel 2010 Finally Fixes SpecialCells 8192 Limit</title>
		<link>http://www.excelguru.ca/blog/2009/07/23/excel-2010-finally-fixes-specialcells-8192-limit/</link>
		<comments>http://www.excelguru.ca/blog/2009/07/23/excel-2010-finally-fixes-specialcells-8192-limit/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 05:24:22 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[Office 2010]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/07/23/excel-2010-finally-fixes-specialcells-8192-limit/</guid>
		<description><![CDATA[If you filter data out of large data sets, you may have run into an issue where you can hit 8192 non-contiguous ranges, which Excel couldn&#8217;t handle.  While this issue has been in Excel for many versions, I can honestly say that I haven&#8217;t run into it in years, as I&#8217;ve always sorted my [...]]]></description>
			<content:encoded><![CDATA[<p>If you filter data out of large data sets, you may have run into an issue where you can hit 8192 non-contiguous ranges, which Excel couldn&#8217;t handle.  While this issue has been in Excel for many versions, I can honestly say that I haven&#8217;t run into it in years, as I&#8217;ve always sorted my data first, to avoid this issue.
</p>
<p>To replicate the issue, try this in any version of Excel prior to 2010:
</p>
<p>Enter the following data in a blank sheet:
</p>
<ul>
<li>A1:    Row
</li>
<li>B1:    Index
</li>
<li>A2:    =ROW(B2)
</li>
<li>B2:    =IF(A1=1,2,1)
</li>
</ul>
<p>Now copy row 2 down about 20,000 rows…
</p>
<p>Next, select row 1 and Filter your data on Column B to only show 1&#8217;s
</p>
<p>Now, select from cell A3 to the end of your data in column B and try to copy it…  You&#8217;ll get a message like this one…
</p>
<p><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/072409_0524_Excel2010Fi1.png" alt=""/>
	</p>
<p>Well guess what… that&#8217;s no longer necessary!  In Excel 2010, the Excel team has removed this limit.  And while I haven&#8217;t tested this, the new limit is apparently imposed by the memory in your computer, not a hard coded limit.
</p>
<p>It&#8217;s great to see that such a long standing bug has finally been resolved.  <img src='http://www.excelguru.ca/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/07/23/excel-2010-finally-fixes-specialcells-8192-limit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Re-Active vs Pro-Active Data Validation</title>
		<link>http://www.excelguru.ca/blog/2009/07/22/re-active-vs-pro-active-data-validation/</link>
		<comments>http://www.excelguru.ca/blog/2009/07/22/re-active-vs-pro-active-data-validation/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 04:11:39 +0000</pubDate>
		<dc:creator>Ken Puls</dc:creator>
				<category><![CDATA[Excel]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.excelguru.ca/blog/2009/07/22/re-active-vs-pro-active-data-validation/</guid>
		<description><![CDATA[Cherisse asks:
Is there a way to set a conditional format for a cell or row to look at the date and format if that date falls on a specific day of the week.  IE—date input as 7/21/09, cell formatted to show &#8220;Tuesday, July 21, 2009&#8243;, want to format all cells that contain the word &#8220;Tuesday&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>Cherisse asks:</p>
<p style="margin-left: 36pt"><em>Is there a way to set a conditional format for a cell or row to look at the date and format if that date falls on a specific day of the week.  IE—date input as 7/21/09, cell formatted to show &#8220;Tuesday, July 21, 2009&#8243;, want to format all cells that contain the word &#8220;Tuesday&#8221; as red.<br />
</em></p>
<p>I know from experience that many users seem unaware that dates in Excel are actually numbers.  It drives me crazy, as it can easily bugger up formulas later on down the line, but fortunately we can deal with this.</p>
<p>So Cherisse, the answer is… Of course!  One thing I would advise though… if you can, prevent the user from entering an invalid date to begin with using Data Validation first, then you don&#8217;t have to worry about the garbage ever getting in to your spreadsheet.  But, because you asked, I&#8217;ll walk through the conditional format route first…</p>
<h1>Re-Active Date Validation Using Conditional Formats</h1>
<p>To validate this data, I would go through two steps.</p>
<p>The first step is to set up the format on the cell for the correct input type.  So right click the cell, choose &#8220;Format Cells&#8221;.  On the Number Format tab, choose Date, and choose the date format:</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/072309_0411_ReActivevsP1.png" /></p>
<p>Second, we set up a conditional format.  In Excel 2003 go to Format<span style="font-family: Wingdings">à</span>Conditional Formatting<span style="font-family: Wingdings">à</span>Formula Is.  In Excel 2007 go to Home<span style="font-family: Wingdings">à</span>Conditional Formatting<span style="font-family: Wingdings">à</span>New Rule<span style="font-family: Wingdings">à</span>Use a Formula…</p>
<p>Set up the rule as follows (assuming the input cell is in B5):</p>
<ul style="margin-left: 54pt">
<li>Formula:    =IsNumber(B5)=False</li>
<li>Font:    Bold, White</li>
<li>Fill:        Red</li>
</ul>
<p>This will highlight the cell in red if the input is not numeric, as shown below.  (I copied the format to cell B6 as well.)</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/072309_0411_ReActivevsP2.png" /></p>
<p>Okay, so this is great, but what if we want to change this so that anything that isn&#8217;t a valid Tuesday is highlighted?  We do this by modifying the conditional format&#8217;s formula:</p>
<ul style="margin-left: 54pt">
<li>Excel 2003    =OR(ISNUMBER(B5)=FALSE,IF(ISERR(WEEKDAY(B5)&lt;&gt;3),TRUE,WEEKDAY(B5)&lt;&gt;3))</li>
<li>Excel 2007    =OR(ISNUMBER(B5)=FALSE,IFERROR(WEEKDAY(B5)&lt;&gt;3,TRUE))</li>
</ul>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/072309_0411_ReActivevsP3.png" /></p>
<h1>Pro-Active Date Validation Using Data Validation</h1>
<p>As I mentioned above, I&#8217;d actually approach this a little differently, and prevent a user from even entering invalid data in the first place.  The method to do that is Excel&#8217;s Data Validation tool.</p>
<p>In Excel 2003 go to Data<span style="font-family: Wingdings">à</span> Validation.  In Excel 2007 go to Data<span style="font-family: Wingdings">à</span>Data Validation</p>
<p>I usually set up the rule as follows:</p>
<ul style="margin-left: 54pt">
<li>Allow:        Date</li>
<li>Data:        Greater Than</li>
<li>Start Date:    =Today()-1</li>
</ul>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/072309_0411_ReActivevsP4.png" /></p>
<p>This rule means that you can enter today&#8217;s date or higher.</p>
<p>We want only want the user to enter a valid Tuesday though, so let&#8217;s change this a bit and go with the following rule:</p>
<ul style="margin-left: 54pt">
<li>Allow:        Custom</li>
<li>Formula:    =WEEKDAY(B5)=3</li>
</ul>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/072309_0411_ReActivevsP5.png" /></p>
<p><strong><em>The real slick thing here is that you don&#8217;t need a conditional format, as the user will be prevented from ever entering anything that is not a valid date AND a Tuesday.<br />
</em></strong></p>
<p>One word of advice though… the default error message isn&#8217;t really intuitive:</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/072309_0411_ReActivevsP6.png" /></p>
<p>You can customize this error by filling in the Error Alert tab.  I usually put a nice descriptive error in there to tell the user what to do.  Something like:</p>
<p style="margin-left: 36pt"><em>This field only accepts Tuesday&#8217;s that are entered in a valid format.  Please enter a Tuesday in the format MM/DD/YY.<br />
</em></p>
<p>The effect will look like this:</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/072309_0411_ReActivevsP7.png" /></p>
<p>And if you want to be even more helpful, fill in the Input Message tab as well…</p>
<p style="margin-left: 36pt"><img src="http://www.excelguru.ca/blog/wp-content/uploads/2009/07/072309_0411_ReActivevsP8.png" /></p>
<h1>Conclusion</h1>
<p>Wherever possible, you should try pro-actively validate your data before the user can even commit it.  The Data Validation tool is great for this purpose.  You will find, however, that there will be times where you just can&#8217;t pro-actively evaluate everything… and that is where conditional formatting can be really handy as a Re-Active Data Validation tool.  I often use the two in combination to generate a really robust interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.excelguru.ca/blog/2009/07/22/re-active-vs-pro-active-data-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
