<?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: Move Up/Move Down in a ListBox</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: JP</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-37929</link>
		<dc:creator>JP</dc:creator>
		<pubDate>Fri, 13 Feb 2009 16:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-37929</guid>
		<description>&lt;p&gt;Nice. I&#039;ll make a list and start working on this next week.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nice. I&#8217;ll make a list and start working on this next week.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-37926</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Fri, 13 Feb 2009 15:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-37926</guid>
		<description>&lt;p&gt;Let the user define new fields.  They name it and make it a&lt;/p&gt;
&lt;p&gt;1) Number - Min, Max&lt;br&gt;
2) String - Length, case(proper, lower, upper)&lt;br&gt;
3) Regex - They put in a regular expression and you output a string that would pass it&lt;br&gt;
4) Date - Min, Max (or split into day, month, year with separate criteria for each)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Let the user define new fields.  They name it and make it a</p>
<p>1) Number &#8211; Min, Max<br />
2) String &#8211; Length, case(proper, lower, upper)<br />
3) Regex &#8211; They put in a regular expression and you output a string that would pass it<br />
4) Date &#8211; Min, Max (or split into day, month, year with separate criteria for each)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-37914</link>
		<dc:creator>JP</dc:creator>
		<pubDate>Fri, 13 Feb 2009 01:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-37914</guid>
		<description>&lt;p&gt;Feel free to suggest. I&#039;m working on an Outlook version of my Post to Twitter add-in, I can add to this one as well.&lt;/p&gt;
&lt;p&gt;Thx&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Feel free to suggest. I&#8217;m working on an Outlook version of my Post to Twitter add-in, I can add to this one as well.</p>
<p>Thx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-37891</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Thu, 12 Feb 2009 00:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-37891</guid>
		<description>&lt;p&gt;&lt;strong&gt;JP&lt;/strong&gt;  Awesome.  This is going to a very useful add-in, I think.  I&#039;ve already got some ideas for the next version (e.g. custom fields).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p><strong>JP</strong>  Awesome.  This is going to a very useful add-in, I think.  I&#8217;ve already got some ideas for the next version (e.g. custom fields).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-37882</link>
		<dc:creator>JP</dc:creator>
		<pubDate>Wed, 11 Feb 2009 14:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-37882</guid>
		<description>&lt;p&gt;Hey Dick &lt;/p&gt;
&lt;p&gt;I updated the add-in and should be re-released it again later today. Thanks again for your help.&lt;/p&gt;
&lt;p&gt;JP&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey Dick </p>
<p>I updated the add-in and should be re-released it again later today. Thanks again for your help.</p>
<p>JP</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-37847</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Sun, 08 Feb 2009 23:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-37847</guid>
		<description>&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; MoveItem(lOffset &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;)&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; aTemp() &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; i &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt; Me.lstToInclude&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; .ListIndex &gt; -1 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;ReDim&lt;/span&gt; aTemp(0 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; .ColumnCount - 1)&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; i = 0 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; .ColumnCount - 1&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; aTemp(i) = .List(.ListIndex + lOffset, i)&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; .List(.ListIndex + lOffset, i) = .List(.ListIndex, i)&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; .List(.ListIndex, i) = aTemp(i)&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; i&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; .Selected(.ListIndex) = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; .ListIndex = .ListIndex + lOffset&lt;br&gt;
&#160; &#160; &#160; .Selected(.ListIndex) = &lt;span class=&quot;kw1&quot;&gt;True&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;With&lt;/span&gt;&lt;br&gt;
&#160;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://www.codeforexcelandoutlook.com/blog/2009/02/random-sample-data-generator-add-in-for-excel-now-available/&quot; rel=&quot;nofollow&quot;&gt;http://www.codeforexcelandoutlook.com/blog/2009/02/random-sample-data-generator-add-in-for-excel-now-available/&lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Private</span> <span class="kw1">Sub</span> MoveItem(lOffset <span class="kw1">As</span> <span class="kw1">Long</span>)<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">Dim</span> aTemp() <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> i <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">With</span> Me.lstToInclude<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">If</span> .ListIndex &gt; -1 <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">ReDim</span> aTemp(0 <span class="kw1">To</span> .ColumnCount &#8211; 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">For</span> i = 0 <span class="kw1">To</span> .ColumnCount &#8211; 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aTemp(i) = .List(.ListIndex + lOffset, i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .List(.ListIndex + lOffset, i) = .List(.ListIndex, i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .List(.ListIndex, i) = aTemp(i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Next</span> i<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; .Selected(.ListIndex) = <span class="kw1">False</span><br />
&nbsp; &nbsp; &nbsp; .ListIndex = .ListIndex + lOffset<br />
&nbsp; &nbsp; &nbsp; .Selected(.ListIndex) = <span class="kw1">True</span><br />
&nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">With</span><br />
&nbsp;<br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
<p><a href="http://www.codeforexcelandoutlook.com/blog/2009/02/random-sample-data-generator-add-in-for-excel-now-available/" rel="nofollow">http://www.codeforexcelandoutlook.com/blog/2009/02/random-sample-data-generator-add-in-for-excel-now-available/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marnix Venema</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-34852</link>
		<dc:creator>Marnix Venema</dc:creator>
		<pubDate>Sun, 21 Sep 2008 06:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-34852</guid>
		<description>&lt;p&gt;I wanted to make it move sheets and have com up with the following.  Perhaps that someone else likes this too!&lt;/p&gt;
&lt;p&gt;Private Sub UserForm_Initialize()&lt;/p&gt;
&lt;p&gt;    Dim sVal As String&lt;br&gt;
    Dim dataSheet As Worksheet&lt;br&gt;
    Dim iDataRow As Long&lt;/p&gt;
&lt;p&gt;    Set dataSheet = Sheets(&quot;Sheet1?)&lt;/p&gt;
&lt;p&gt;    &#039;Fill in the listbox&lt;br&gt;
    lbxTeams.Clear&lt;br&gt;
    &#039;Column A contains the item list (Row 1 is the column header)&lt;br&gt;
    iDataRow = 2    &#039;first item in the list&lt;br&gt;
    Do While Len(dataSheet.Range(&quot;A&quot; &amp; iDataRow).Text) &gt; 0&lt;br&gt;
        sVal = dataSheet.Range(&quot;A&quot; &amp; iDataRow).Text&lt;br&gt;
        lbxTeams.AddItem sVal&lt;br&gt;
        iDataRow = iDataRow + 1&lt;br&gt;
    Loop&lt;br&gt;
End Sub&lt;br&gt;
Private Sub cmdDown_Click()&lt;/p&gt;
&lt;p&gt;    Dim ShtIndex As Integer&lt;br&gt;
    Dim AftrSht As String&lt;/p&gt;
&lt;p&gt;    &#039;Move Item in ListBox&lt;br&gt;
    MoveItem 1&lt;/p&gt;
&lt;p&gt;    &#039;Get Values for Moving Sheets&lt;br&gt;
    ShtIndex = lbxTeams.ListIndex&lt;br&gt;
    AftrSht = lbxTeams.List(ShtIndex - 1, 0)&lt;/p&gt;
&lt;p&gt;    &#039;Move After Sheet...&lt;br&gt;
    Sheets(lbxTeams.Value).Move After:=Sheets(AftrSht)&lt;/p&gt;
&lt;p&gt;End Sub&lt;br&gt;
Private Sub cmdUp_Click()&lt;/p&gt;
&lt;p&gt;    Dim ShtIndex As Integer&lt;br&gt;
    Dim BfrSht As String&lt;/p&gt;
&lt;p&gt;    &#039;Move Item in ListBox&lt;br&gt;
    MoveItem -1&lt;/p&gt;
&lt;p&gt;    &#039;Get Values for Moving Sheets&lt;br&gt;
    ShtIndex = lbxTeams.ListIndex&lt;br&gt;
    BfrSht = lbxTeams.List(ShtIndex + 1, 0)&lt;/p&gt;
&lt;p&gt;    &#039;Move Before Sheet...&lt;br&gt;
    Sheets(lbxTeams.Value).Move Before:=Sheets(BfrSht)&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;Private Sub MoveItem(lOffset As Long)&lt;/p&gt;
&lt;p&gt;    Dim aTemp() As String&lt;br&gt;
    Dim i As Long&lt;/p&gt;
&lt;p&gt;    On Error GoTo EndSub&lt;/p&gt;
&lt;p&gt;    With Me.lbxTeams&lt;br&gt;
        If .ListIndex &gt; -1 Then&lt;br&gt;
            ReDim aTemp(0 To .ColumnCount - 1)&lt;br&gt;
            For i = 0 To .ColumnCount - 1&lt;br&gt;
                aTemp(i) = .List(.ListIndex + lOffset, i)&lt;br&gt;
                .List(.ListIndex + lOffset, i) = .List(.ListIndex, i)&lt;br&gt;
                .List(.ListIndex, i) = aTemp(i)&lt;br&gt;
            .ListIndex = .ListIndex + lOffset&lt;br&gt;
            Next i&lt;br&gt;
        End If&lt;br&gt;
    End With&lt;/p&gt;
&lt;p&gt;EndSub: End Sub&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I wanted to make it move sheets and have com up with the following.  Perhaps that someone else likes this too!</p>
<p>Private Sub UserForm_Initialize()</p>
<p>    Dim sVal As String<br />
    Dim dataSheet As Worksheet<br />
    Dim iDataRow As Long</p>
<p>    Set dataSheet = Sheets(&#8220;Sheet1?)</p>
<p>    &#8216;Fill in the listbox<br />
    lbxTeams.Clear<br />
    &#8216;Column A contains the item list (Row 1 is the column header)<br />
    iDataRow = 2    &#8216;first item in the list<br />
    Do While Len(dataSheet.Range(&#8220;A&#8221; &amp; iDataRow).Text) &gt; 0<br />
        sVal = dataSheet.Range(&#8220;A&#8221; &amp; iDataRow).Text<br />
        lbxTeams.AddItem sVal<br />
        iDataRow = iDataRow + 1<br />
    Loop<br />
End Sub<br />
Private Sub cmdDown_Click()</p>
<p>    Dim ShtIndex As Integer<br />
    Dim AftrSht As String</p>
<p>    &#8216;Move Item in ListBox<br />
    MoveItem 1</p>
<p>    &#8216;Get Values for Moving Sheets<br />
    ShtIndex = lbxTeams.ListIndex<br />
    AftrSht = lbxTeams.List(ShtIndex &#8211; 1, 0)</p>
<p>    &#8216;Move After Sheet&#8230;<br />
    Sheets(lbxTeams.Value).Move After:=Sheets(AftrSht)</p>
<p>End Sub<br />
Private Sub cmdUp_Click()</p>
<p>    Dim ShtIndex As Integer<br />
    Dim BfrSht As String</p>
<p>    &#8216;Move Item in ListBox<br />
    MoveItem -1</p>
<p>    &#8216;Get Values for Moving Sheets<br />
    ShtIndex = lbxTeams.ListIndex<br />
    BfrSht = lbxTeams.List(ShtIndex + 1, 0)</p>
<p>    &#8216;Move Before Sheet&#8230;<br />
    Sheets(lbxTeams.Value).Move Before:=Sheets(BfrSht)</p>
<p>End Sub</p>
<p>Private Sub MoveItem(lOffset As Long)</p>
<p>    Dim aTemp() As String<br />
    Dim i As Long</p>
<p>    On Error GoTo EndSub</p>
<p>    With Me.lbxTeams<br />
        If .ListIndex &gt; -1 Then<br />
            ReDim aTemp(0 To .ColumnCount &#8211; 1)<br />
            For i = 0 To .ColumnCount &#8211; 1<br />
                aTemp(i) = .List(.ListIndex + lOffset, i)<br />
                .List(.ListIndex + lOffset, i) = .List(.ListIndex, i)<br />
                .List(.ListIndex, i) = aTemp(i)<br />
            .ListIndex = .ListIndex + lOffset<br />
            Next i<br />
        End If<br />
    End With</p>
<p>EndSub: End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-28083</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Tue, 16 Oct 2007 14:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-28083</guid>
		<description>&lt;p&gt;I never use the RowSource property to populate a control. My calling code feeds the form an array using a public let property. Often the array is simply taken from a worksheet range, but this is much more flexible than locking myself into the range. If I need the worksheet to change, well, the form feeds the array back to the calling code using a public get property.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I never use the RowSource property to populate a control. My calling code feeds the form an array using a public let property. Often the array is simply taken from a worksheet range, but this is much more flexible than locking myself into the range. If I need the worksheet to change, well, the form feeds the array back to the calling code using a public get property.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Pope</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-28082</link>
		<dc:creator>Andy Pope</dc:creator>
		<pubDate>Tue, 16 Oct 2007 08:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-28082</guid>
		<description>&lt;p&gt;Hi Apirus,&lt;/p&gt;
&lt;p&gt;You would get that error if you populated the listbox using the RowSource property.&lt;br&gt;
When using rowsource you can not change the order of the listbox using the above method. You would need to change the cells directly.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Apirus,</p>
<p>You would get that error if you populated the listbox using the RowSource property.<br />
When using rowsource you can not change the order of the listbox using the above method. You would need to change the cells directly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Apirus</title>
		<link>http://www.dailydoseofexcel.com/archives/2004/06/14/move-upmove-down-in-a-listbox/#comment-28032</link>
		<dc:creator>Apirus</dc:creator>
		<pubDate>Fri, 12 Oct 2007 16:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=628#comment-28032</guid>
		<description>&lt;p&gt;I have been trying to reorder rows in a list box.&lt;br&gt;
I am getting an error&lt;/p&gt;
&lt;p&gt;&quot;Run-Time Error &#039;70&#039; .Could not set the list property. Permission denied.&lt;/p&gt;
&lt;p&gt;Any suggestions please&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I have been trying to reorder rows in a list box.<br />
I am getting an error</p>
<p>&#8220;Run-Time Error &#8217;70&#8242; .Could not set the list property. Permission denied.</p>
<p>Any suggestions please</p>
]]></content:encoded>
	</item>
</channel>
</rss>

