<?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: New Worksheet Location</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 23:42:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Tushar Mehta</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/#comment-22884</link>
		<dc:creator>Tushar Mehta</dc:creator>
		<pubDate>Mon, 26 Mar 2007 05:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1627#comment-22884</guid>
		<description>&lt;p&gt;Dunno why the VB tags did&#039;nt work.  Here&#039;s the same post with the tags in upper case.&lt;/p&gt;
&lt;p&gt;Keeping in mind that I think this is overkill...and one of the reasons it is overkill is the saving in time, which over an entire year might add up to a few seconds, will be more than &#039;undone&#039; by writing, debugging, and maintaining the code...&lt;/p&gt;
&lt;p&gt;This will fail in 2007 if you click the newly added &#039;tab&#039; (or should it be called a button?) that is located to the right of all the sheet tabs.  The new tab/button creates a new worksheet as the last sheet in the workbook.  Similarly, the code will fail if one were to programmatically add a new sheet at the end of a workbook.&lt;/p&gt;
&lt;p&gt;So, one should modify the code to be &lt;code lang=&quot;vb&quot;&gt;&lt;br&gt;
Private Sub myApp_WorkbookNewSheet(ByVal Wb As Workbook, _&lt;br&gt;
        ByVal Sh As Object)&lt;br&gt;
    With Wb&lt;br&gt;
    If Sh.Index&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dunno why the VB tags did&#8217;nt work.  Here&#8217;s the same post with the tags in upper case.</p>
<p>Keeping in mind that I think this is overkill&#8230;and one of the reasons it is overkill is the saving in time, which over an entire year might add up to a few seconds, will be more than &#8216;undone&#8217; by writing, debugging, and maintaining the code&#8230;</p>
<p>This will fail in 2007 if you click the newly added &#8216;tab&#8217; (or should it be called a button?) that is located to the right of all the sheet tabs.  The new tab/button creates a new worksheet as the last sheet in the workbook.  Similarly, the code will fail if one were to programmatically add a new sheet at the end of a workbook.</p>
<p>So, one should modify the code to be</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;br&gt;<br />
<span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> myApp_WorkbookNewSheet(<span style="color: #151B8D; font-weight: bold;">ByVal</span> Wb <span style="color: #151B8D; font-weight: bold;">As</span> Workbook, _&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #151B8D; font-weight: bold;">ByVal</span> Sh <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Object</span>)&lt;br&gt;<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">With</span> Wb&lt;br&gt;<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">If</span> Sh.Index</div></div></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tushar Mehta</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/#comment-22883</link>
		<dc:creator>Tushar Mehta</dc:creator>
		<pubDate>Mon, 26 Mar 2007 05:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1627#comment-22883</guid>
		<description>&lt;p&gt;Keeping in mind that I think this is overkill...and one of the reasons it is overkill is the saving in time, which over an entire year might add up to a few seconds, will be more than &#039;undone&#039; by writing, debugging, and maintaining the code...&lt;/p&gt;
&lt;p&gt;This will fail in 2007 if you click the newly added &#039;tab&#039; (or should it be called a button?) that is located to the right of all the sheet tabs.  The new tab/button creates a new worksheet as the last sheet in the workbook.  Similarly, the code will fail if one were to programmatically add a new sheet at the end of a workbook.&lt;/p&gt;
&lt;p&gt;So, one should modify the code to be &lt;code lang=&quot;vb&quot;&gt;&lt;br&gt;
Private Sub myApp_WorkbookNewSheet(ByVal Wb As Workbook, _&lt;br&gt;
        ByVal Sh As Object)&lt;br&gt;
    With Wb&lt;br&gt;
    If Sh.Index&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Keeping in mind that I think this is overkill&#8230;and one of the reasons it is overkill is the saving in time, which over an entire year might add up to a few seconds, will be more than &#8216;undone&#8217; by writing, debugging, and maintaining the code&#8230;</p>
<p>This will fail in 2007 if you click the newly added &#8216;tab&#8217; (or should it be called a button?) that is located to the right of all the sheet tabs.  The new tab/button creates a new worksheet as the last sheet in the workbook.  Similarly, the code will fail if one were to programmatically add a new sheet at the end of a workbook.</p>
<p>So, one should modify the code to be</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;br&gt;<br />
<span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> myApp_WorkbookNewSheet(<span style="color: #151B8D; font-weight: bold;">ByVal</span> Wb <span style="color: #151B8D; font-weight: bold;">As</span> Workbook, _&lt;br&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #151B8D; font-weight: bold;">ByVal</span> Sh <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Object</span>)&lt;br&gt;<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">With</span> Wb&lt;br&gt;<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">If</span> Sh.Index</div></div></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ross</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/#comment-22854</link>
		<dc:creator>ross</dc:creator>
		<pubDate>Fri, 23 Mar 2007 00:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1627#comment-22854</guid>
		<description>&lt;p&gt;... there goes Ken with his Addins ;-)&lt;/p&gt;
&lt;p&gt;This is an example of &quot;poor&quot; MS design - this type of thing is ok in Excel 5, but by 2000 it should be putting it to the right - God knows why anyone would design it to put it to the left - maybe if your regional settings where right to left text? &lt;/p&gt;
&lt;p&gt;Having said that I&#039;m a mouse jockey, so once i click insert, i rename and drag it across - true though on a big wkb it can be a pain.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8230; there goes Ken with his Addins <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>This is an example of &#8220;poor&#8221; MS design &#8211; this type of thing is ok in Excel 5, but by 2000 it should be putting it to the right &#8211; God knows why anyone would design it to put it to the left &#8211; maybe if your regional settings where right to left text? </p>
<p>Having said that I&#8217;m a mouse jockey, so once i click insert, i rename and drag it across &#8211; true though on a big wkb it can be a pain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken Puls</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/#comment-22846</link>
		<dc:creator>Ken Puls</dc:creator>
		<pubDate>Thu, 22 Mar 2007 18:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1627#comment-22846</guid>
		<description>&lt;p&gt;Hi Dick,&lt;/p&gt;
&lt;p&gt;I don&#039;t think it would fail, as the &quot;Sheets&quot; collection will deal equally well with Chart sheets, Macro pages, etc...  One thing that can scramble it a little bit is if you insert a file that has multiple pages.  (i.e. Insert a multi-sheet template into your workbook.)  It doesn&#039;t move all pages to the end, but rather shuffles the order a little.  (I can&#039;t think that many people would do this though.)&lt;/p&gt;
&lt;p&gt;Fwiw, I would agree with Matt that the best placement of this kind of thing is in a separate add-in, rather than in the personal.xls.  It then doesn&#039;t get tocuhed, and doesn&#039;t accidentally collapse on you when you start tinkering with other code in the Personal.xls file.  :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Dick,</p>
<p>I don&#8217;t think it would fail, as the &#8220;Sheets&#8221; collection will deal equally well with Chart sheets, Macro pages, etc&#8230;  One thing that can scramble it a little bit is if you insert a file that has multiple pages.  (i.e. Insert a multi-sheet template into your workbook.)  It doesn&#8217;t move all pages to the end, but rather shuffles the order a little.  (I can&#8217;t think that many people would do this though.)</p>
<p>Fwiw, I would agree with Matt that the best placement of this kind of thing is in a separate add-in, rather than in the personal.xls.  It then doesn&#8217;t get tocuhed, and doesn&#8217;t accidentally collapse on you when you start tinkering with other code in the Personal.xls file.  <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Vidas</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/#comment-22844</link>
		<dc:creator>Matt Vidas</dc:creator>
		<pubDate>Thu, 22 Mar 2007 14:27:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1627#comment-22844</guid>
		<description>&lt;p&gt;I like this idea! I always want it to the right of my activesheet as well (I use shift-F11 to add it), and have always just moved it.&lt;br&gt;
As Rick said, the project could reset (step through a proc, even just one line, then click the end button; design mode could be also be toggled) and you could lose the object variable. To get around that, I will often put application-level events into a separate add-in, which would stay small (quick load) and usually won&#039;t get touched (also won&#039;t conflict with any other code in personal.xls). You could also put something like this into some other events to ensure the object is working: &quot;if gclsapp is nothing then set gclsapp=new cappevent&quot;, though that kind of line works best if you set &#039;myApp&#039; in the Class_Initialize event.&lt;/p&gt;
&lt;p&gt;Also, not that it really makes much of a difference, but you don&#039;t need the public variable in a standard module. Putting &quot;Dim gclsApp As CAppEvent&quot; in ThisWorkbook will work just as well.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I like this idea! I always want it to the right of my activesheet as well (I use shift-F11 to add it), and have always just moved it.<br />
As Rick said, the project could reset (step through a proc, even just one line, then click the end button; design mode could be also be toggled) and you could lose the object variable. To get around that, I will often put application-level events into a separate add-in, which would stay small (quick load) and usually won&#8217;t get touched (also won&#8217;t conflict with any other code in personal.xls). You could also put something like this into some other events to ensure the object is working: &#8220;if gclsapp is nothing then set gclsapp=new cappevent&#8221;, though that kind of line works best if you set &#8216;myApp&#8217; in the Class_Initialize event.</p>
<p>Also, not that it really makes much of a difference, but you don&#8217;t need the public variable in a standard module. Putting &#8220;Dim gclsApp As CAppEvent&#8221; in ThisWorkbook will work just as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/#comment-22843</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Thu, 22 Mar 2007 14:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1627#comment-22843</guid>
		<description>&lt;p&gt;Rick:  I don&#039;t know all the things that reset the project, but I&#039;d like to.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Rick:  I don&#8217;t know all the things that reset the project, but I&#8217;d like to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/#comment-22840</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Thu, 22 Mar 2007 05:21:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1627#comment-22840</guid>
		<description>&lt;p&gt;Hi Dick...&lt;/p&gt;
&lt;p&gt;The below code works fine...:-)&lt;/p&gt;
&lt;p&gt;Sub AddSheetToRight()&lt;br&gt;
&#039; KeyBoard Shortcut Ctrl+Shift+i&lt;br&gt;
ActiveWorkbook.Sheets.Add After:=Worksheets(ActiveSheet.Index)&lt;br&gt;
End Sub&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Dick&#8230;</p>
<p>The below code works fine&#8230;:-)</p>
<p>Sub AddSheetToRight()<br />
&#8216; KeyBoard Shortcut Ctrl+Shift+i<br />
ActiveWorkbook.Sheets.Add After:=Worksheets(ActiveSheet.Index)<br />
End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Williams</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/03/21/new-worksheet-location/#comment-22836</link>
		<dc:creator>Rick Williams</dc:creator>
		<pubDate>Thu, 22 Mar 2007 00:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1627#comment-22836</guid>
		<description>&lt;p&gt;I just tried it out and it&#039;s a great idea! (I always forget how to set-up a class module to respond to events!)&lt;/p&gt;
&lt;p&gt;The only way I can see it &#039;failing&#039; is when your &#039;personal.xls&#039; workbook is reset - the global variable (gclsApp) is lost.  When I made changes which reset the project, I just clicked in the Workbook_Open event and hit F5.&lt;/p&gt;
&lt;p&gt;Also I&#039;m not sure on exactly &lt;i&gt;what&lt;/i&gt; changes do and don&#039;t trigger a reset of VBA projects... any help?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I just tried it out and it&#8217;s a great idea! (I always forget how to set-up a class module to respond to events!)</p>
<p>The only way I can see it &#8216;failing&#8217; is when your &#8216;personal.xls&#8217; workbook is reset &#8211; the global variable (gclsApp) is lost.  When I made changes which reset the project, I just clicked in the Workbook_Open event and hit F5.</p>
<p>Also I&#8217;m not sure on exactly <i>what</i> changes do and don&#8217;t trigger a reset of VBA projects&#8230; any help?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

