<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.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>Let's talk sentence-casing in Excel</title><link>http://msmvps.com/blogs/nateoliver/archive/2009/05/22/let-s-talk-sentence-casing-in-excel.aspx</link><description>Good day, So we probably agree that Excel and/or the VBA IDE aren&amp;#39;t the ideal locations to do your word processing, however, it&amp;#39;s done there, either way. Both Excel and VBA (the latter being based on VB6) provide us with some tools to help, in</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: Let's talk sentence-casing in Excel</title><link>http://msmvps.com/blogs/nateoliver/archive/2009/05/22/let-s-talk-sentence-casing-in-excel.aspx#1710724</link><pubDate>Wed, 29 Jul 2009 13:30:04 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1710724</guid><dc:creator>James_B</dc:creator><description>&lt;p&gt;Dude, I love your stuff--both on this blog and elsewhere. &amp;nbsp;Anyway, just to say, this SentenceCase function is turning out to be useful in the extreme: (when I first read this thread, I doubted this).&lt;/p&gt;
&lt;p&gt;For my own purposes, I&amp;#39;ve had to modify (butcher?) the start and end of it so that it can handle arrays (that can be written back to a worksheet). &amp;nbsp;There&amp;#39;s doubtless a more optimised way of doing such a thing, but this does the job (I think) as a quick workaround. &amp;nbsp;Cheers again, James.&lt;/p&gt;
&lt;p&gt;P.S. &amp;nbsp;Shout &amp;nbsp;if I&amp;#39;ve made some stupid error in the below&lt;/p&gt;
&lt;p&gt;Public Function SCase(ByRef sIn As Variant) As Variant&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Dim e As Long&lt;/p&gt;
&lt;p&gt; &amp;nbsp; If IsEmpty(sIn) Then Exit Function&lt;/p&gt;
&lt;p&gt; &amp;nbsp; If TypeName(sIn) = &amp;quot;String&amp;quot; Then sIn = Array(sIn)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; For e = LBound(sIn) To UBound(sIn)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim i As Long, ii As Long, UB As Long&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim bArr() As Byte&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;If LenB(sIn(e)) = 0 Then Exit For&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;bArr = sIn(e)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;UB = UBound(bArr) - 1 &amp;#39;since we&amp;#39;re not looping the last byte&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;If bArr(1) = 0 Then &amp;#39;&amp;lt;-- only if zero&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select Case bArr(0)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Case 97 To 122, 224 To 246, 248 To 255 &amp;#39;some more lcase characters&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bArr(0) = bArr(0) - 32&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;For i = 2 To UB Step 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If bArr(i + 1) = 0 Then &amp;#39;only look at letters with 2nd byte = 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case bArr(i)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 105&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If i &amp;lt;&amp;gt; UB Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case bArr(i + 2)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 32, 33, 39, 44, 46, 58, 59, 63, 148, 160&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If bArr(i - 2) = 32 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bArr(i) = bArr(i) - 32&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ElseIf bArr(i - 2) = 32 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bArr(i) = bArr(i) - 32&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 33, 46, 58, 63&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; For ii = i + 2 To UB Step 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case bArr(ii)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 97 To 122, 193 To 246, 248 To 255&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bArr(ii) = bArr(ii) - 32&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; i = ii: Exit For&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case bArr(ii)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 32, 33, 46, 63, 160&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#39;Do nothing&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; i = ii: Exit For&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Next ii&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;sIn(e) = CStr(bArr)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Next e&lt;/p&gt;
&lt;p&gt; &amp;nbsp; SCase = sIn&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1710724" width="1" height="1"&gt;</description></item><item><title>re: Let's talk sentence-casing in Excel</title><link>http://msmvps.com/blogs/nateoliver/archive/2009/05/22/let-s-talk-sentence-casing-in-excel.aspx#1693745</link><pubDate>Wed, 03 Jun 2009 19:38:01 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1693745</guid><dc:creator>Nate Oliver</dc:creator><description>&lt;p&gt;Hi Peter, thanks for joining in the fray! I&amp;#39;ll be sure to test that out.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m pretty sure the I/i deal is pretty much limited to English. I struggle to recall throughout my French classes where I&amp;#39;d have an upper-case I, as such.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know if it&amp;#39;s appropriate, but it was part of the original question that I was attempting to answer... I seem to recall someone familiar showing up in the same thread, now that I think about it. &amp;lt;g&amp;gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1693745" width="1" height="1"&gt;</description></item><item><title>re: Let's talk sentence-casing in Excel</title><link>http://msmvps.com/blogs/nateoliver/archive/2009/05/22/let-s-talk-sentence-casing-in-excel.aspx#1693738</link><pubDate>Wed, 03 Jun 2009 19:23:51 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1693738</guid><dc:creator>Peter Thornton</dc:creator><description>&lt;p&gt;Yeah manipulating strings via a byte array is very efficient. But as you say there are pitfalls with non English characters and in particular with Unicode wide characters and a non English codepage system.&lt;/p&gt;
&lt;p&gt;AFAIK there&amp;#39;s never any ambiguity with ASCII 0-127. I&amp;#39;m fairly sure AINSII 128-255 is consitent in Latin languages. So with these caveats, simply checking if the 2nd byte is zero will exclude the majority of characters we need to avoid (also speeds up the loop considerably).&lt;/p&gt;
&lt;p&gt;All but one of the characters 224-255 are lower case Latin characters that can be treated the same way as &amp;quot;a-z&amp;quot;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t checked your logic, and not withstanding whether or not it&amp;#39;s correct to cater for things like i/I, the following is your routine modified to cater for the things I mentioned. Oh yes, might as well assign UBound -1 to a variable!&lt;/p&gt;
&lt;p&gt;Public Function sCase2(ByRef strIn As String) As String&lt;/p&gt;
&lt;p&gt;Dim i As Long, i2 As Long, ub As Long&lt;/p&gt;
&lt;p&gt;Dim bArr() As Byte&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;If Len(strIn) = 0 Then Exit Function&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;bArr = strIn&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;ub = UBound(bArr) - 1 &amp;nbsp; &amp;nbsp;&amp;#39; we&amp;#39;re not looping the last byte&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;If bArr(1) = 0 Then &amp;nbsp;&amp;#39; &amp;lt; only if zero&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case bArr(0)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 97 To 122, 224 To 246, 248 To 255 &amp;nbsp;&amp;#39; some more lcase characters&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bArr(0) = bArr(0) - 32&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;For i = 2 To ub Step 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If bArr(i + 1) = 0 Then &amp;nbsp;&amp;#39; only look at letters with 2nd byte = 0&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case bArr(i)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 105&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If Not i = ub Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case bArr(i + 2)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 32, 33, 39, 44, 46, 58, 59, 63, 148, 160&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If bArr(i - 2) = 32 Then _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bArr(i) = bArr(i) - 32&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ElseIf bArr(i - 2) = 32 Then _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bArr(i) = bArr(i) - 32&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 33, 46, 58, 63&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For i2 = i + 2 To ub Step 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case bArr(i2)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 97 To 122, 193 To 246, 248 To 255&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bArr(i2) = bArr(i2) - 32&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i = i2: Exit For&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select Case bArr(i2)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case 32, 33, 46, 63, 160&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Case Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i = i2: Exit For&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39;Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#39; it&amp;#39;s chr(128-159) or a wide character&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Select&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;sCase2 = bArr&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1693738" width="1" height="1"&gt;</description></item><item><title>re: Let's talk sentence-casing in Excel</title><link>http://msmvps.com/blogs/nateoliver/archive/2009/05/22/let-s-talk-sentence-casing-in-excel.aspx#1693676</link><pubDate>Tue, 02 Jun 2009 23:30:38 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1693676</guid><dc:creator>Nate Oliver</dc:creator><description>&lt;p&gt;Okay, that is true - my inner-loop UBound() calls aren&amp;#39;t optimized. That probably takes almost no time at all, but I agree, as your saying, a Variable would be faster.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve never used Variable names in my For/Next Loops. I see what you&amp;#39;re saying, does that make me a hypocrite?&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve always just used tabbing to determine which Loop I&amp;#39;m stuck in. You might be right, by the way - I probably am being arbitrary.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1693676" width="1" height="1"&gt;</description></item><item><title>re: Let's talk sentence-casing in Excel</title><link>http://msmvps.com/blogs/nateoliver/archive/2009/05/22/let-s-talk-sentence-casing-in-excel.aspx#1693668</link><pubDate>Tue, 02 Jun 2009 22:02:48 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1693668</guid><dc:creator>fzz</dc:creator><description>&lt;p&gt;OK, I was wrong about the for loop bounds, but you are calling it within the outer For loop, so you are calling it repeatedly. Those calls aren&amp;#39;t optimized.&lt;/p&gt;
&lt;p&gt;For i = 2 To UBound(bArr) Step 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp;:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If Not i = UBound(bArr) - 1 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For i2 = i + 2 To UBound(bArr) Step 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp;:&lt;/p&gt;
&lt;p&gt;Next&lt;/p&gt;
&lt;p&gt;On a tangent, if you like added readability, why not include the variable name in the Next statement?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1693668" width="1" height="1"&gt;</description></item><item><title>re: Let's talk sentence-casing in Excel</title><link>http://msmvps.com/blogs/nateoliver/archive/2009/05/22/let-s-talk-sentence-casing-in-excel.aspx#1693658</link><pubDate>Tue, 02 Jun 2009 19:05:30 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1693658</guid><dc:creator>Nate Oliver</dc:creator><description>&lt;p&gt;Okay, let&amp;#39;s see if we agree with this example:&lt;/p&gt;
&lt;p&gt;Sub foo()&lt;/p&gt;
&lt;p&gt;Dim lngArr() As Long, i As Long&lt;/p&gt;
&lt;p&gt;Dim j As Long&lt;/p&gt;
&lt;p&gt;ReDim lngArr(1 To 30)&lt;/p&gt;
&lt;p&gt;For i = LBound(lngArr) To UBound(lngArr)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Let j = j + 1&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;ReDim Preserve lngArr(1 To 30 + j)&lt;/p&gt;
&lt;p&gt;Next&lt;/p&gt;
&lt;p&gt;Debug.Print j, UBound(lngArr)&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;Note the counter is 30 iterations, while the upper boundary of lngArr has morphed to 60.&lt;/p&gt;
&lt;p&gt;That would seem to indicate Ubound() isn&amp;#39;t being called over and over again, on each iteration, or j should be greater than it is?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1693658" width="1" height="1"&gt;</description></item><item><title>re: Let's talk sentence-casing in Excel</title><link>http://msmvps.com/blogs/nateoliver/archive/2009/05/22/let-s-talk-sentence-casing-in-excel.aspx#1693656</link><pubDate>Tue, 02 Jun 2009 16:48:19 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1693656</guid><dc:creator>Nate Oliver</dc:creator><description>&lt;p&gt;I&amp;#39;m curious about your comment on UBound() being called on each iteration, as it&amp;#39;s not documented as such:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/zxkf5z4b"&gt;msdn.microsoft.com/.../zxkf5z4b&lt;/a&gt;(vs.71).aspx&lt;/p&gt;
&lt;p&gt;&amp;quot;The iteration values start, end, and step are evaluated only once, before the loop begins. If your statement block changes end or step, these changes do not affect the iteration of the loop. In the preceding example, the UBound function is called only when the For statement is first executed. If the statement block had subsequently changed the length of the array A, the For loop would still use the original length as the end value, because it does not call UBound again.&amp;quot;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1693656" width="1" height="1"&gt;</description></item><item><title>re: Let's talk sentence-casing in Excel</title><link>http://msmvps.com/blogs/nateoliver/archive/2009/05/22/let-s-talk-sentence-casing-in-excel.aspx#1693620</link><pubDate>Tue, 02 Jun 2009 05:29:59 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1693620</guid><dc:creator>fzz</dc:creator><description>&lt;p&gt;If you want to speed optimize, use another Long variable, assign UBound(bArr) to it, then use that variable rather than UBound calls. Seems VBA doesn&amp;#39;t provide constant expression optimizations, i.e., it calls UBound on every iteration even though bArr is invariant once initialized.&lt;/p&gt;
&lt;p&gt;Special handling of the English pronoun I isn&amp;#39;t technically part of sentence capitalization. You&amp;#39;re doing it because you&amp;#39;re assuming (as you stated) that you expect the string passed to sCase to have been passed through LCase. Me, I&amp;#39;d figure sentence capitalization should be part of a grammar checker rather than a standalone function. Then one could include logic to ignore lists, e.g.,&lt;/p&gt;
&lt;p&gt;i. This is the first item in the list.&lt;/p&gt;
&lt;p&gt;ii. This is the second item in the list.&lt;/p&gt;
&lt;p&gt;where the &amp;quot;i.&amp;quot; in the first line shouldn&amp;#39;t be capitalized. On the other hand, the following prose is correct English if overdramatic.&lt;/p&gt;
&lt;p&gt;Who was it holding the knife? I.&lt;/p&gt;
&lt;p&gt;Ain&amp;#39;t English wonderful?!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1693620" width="1" height="1"&gt;</description></item></channel></rss>