<?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: Getting Array Data from a Filtered List in VBA</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/</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: gruff999</title>
		<link>http://www.dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/#comment-44574</link>
		<dc:creator>gruff999</dc:creator>
		<pubDate>Mon, 15 Mar 2010 14:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3669#comment-44574</guid>
		<description>&lt;p&gt;If AutoFiltering is enabled, and an AutoFilter is in effect, AutoFilter.Range appears to be a pseudo UsedRange which includes all cells in scope for auto-filtering. The range it refers to doesn&#039;t change with different filtered row counts.&lt;/p&gt;
&lt;p&gt;I used Intersect, feeding in xlVisible and AutoFilter.Range to get what I needed to create a chart from the filtered rows.&lt;/p&gt;
&lt;p&gt;(You have to adjust AutoFilter.Range to remove the first row).&lt;/p&gt;
&lt;p&gt;Not thoroughly tested as I&#039;m referring back to an old bit of code.&lt;/p&gt;
&lt;p&gt;Any good?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If AutoFiltering is enabled, and an AutoFilter is in effect, AutoFilter.Range appears to be a pseudo UsedRange which includes all cells in scope for auto-filtering. The range it refers to doesn&#8217;t change with different filtered row counts.</p>
<p>I used Intersect, feeding in xlVisible and AutoFilter.Range to get what I needed to create a chart from the filtered rows.</p>
<p>(You have to adjust AutoFilter.Range to remove the first row).</p>
<p>Not thoroughly tested as I&#8217;m referring back to an old bit of code.</p>
<p>Any good?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Devo</title>
		<link>http://www.dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/#comment-44439</link>
		<dc:creator>Devo</dc:creator>
		<pubDate>Tue, 09 Mar 2010 23:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3669#comment-44439</guid>
		<description>&lt;p&gt;This worked for me...&lt;/p&gt;
&lt;p&gt;&quot;&quot;&#039;&lt;/p&gt;
&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;Sub&lt;/span&gt; Arr_Visible_Cells()&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; rRow &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; aArr() &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;&lt;br&gt;
&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;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; lCount &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;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; CellCount &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; Range_To_Get &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
CellCount = Sheets(1).UsedRange.Rows.Count&lt;br&gt;
Range_To_Get = Sheets(1).UsedRange.Address&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;ReDim&lt;/span&gt; aArr(1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 3, 1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; CellCount)&lt;br&gt;
&lt;br&gt;
lCount = 1&lt;br&gt;
i = 1&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Each&lt;/span&gt; rRow &lt;span class=&quot;kw1&quot;&gt;In&lt;/span&gt; Sheets(1).Range(Range_To_Get)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; lCount = 4 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; i = i + 1&lt;br&gt;
&#160; &#160; lCount = 1&lt;br&gt;
&#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; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; rRow.Rows.Hidden = &lt;span class=&quot;kw1&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160;aArr(lCount, i) = rRow&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Else&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160;&lt;span class=&quot;kw1&quot;&gt;GoTo&lt;/span&gt; Devo:&lt;br&gt;
&#160; &#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;
lCount = lCount + 1&lt;br&gt;
Devo:&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;ReDim&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Preserve&lt;/span&gt; aArr(1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 3, 1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; i)&lt;br&gt;
&lt;br&gt;
aArr = Application.Transpose(aArr)&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;Good Luck&lt;/p&gt;
&lt;p&gt;Devo&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This worked for me&#8230;</p>
<p>&#8220;&#8221;&#8216;</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> Arr_Visible_Cells()</p>
<p><span class="kw1">Dim</span> rRow <span class="kw1">As</span> Range<br />
<span class="kw1">Dim</span> aArr() <span class="kw1">As</span> <span class="kw1">Variant</span><br />
<span class="kw1">Dim</span> i <span class="kw1">As</span> <span class="kw1">Long</span><br />
<span class="kw1">Dim</span> lCount <span class="kw1">As</span> <span class="kw1">Long</span><br />
<span class="kw1">Dim</span> CellCount <span class="kw1">As</span> <span class="kw1">Variant</span><br />
<span class="kw1">Dim</span> Range_To_Get <span class="kw1">As</span> <span class="kw1">Variant</span></p>
<p>CellCount = Sheets(1).UsedRange.Rows.Count<br />
Range_To_Get = Sheets(1).UsedRange.Address</p>
<p><span class="kw1">ReDim</span> aArr(1 <span class="kw1">To</span> 3, 1 <span class="kw1">To</span> CellCount)</p>
<p>lCount = 1<br />
i = 1<br />
<span class="kw1">For</span> <span class="kw1">Each</span> rRow <span class="kw1">In</span> Sheets(1).Range(Range_To_Get)<br />
&nbsp; &nbsp; <span class="kw1">If</span> lCount = 4 <span class="kw1">Then</span><br />
&nbsp; &nbsp; i = i + 1<br />
&nbsp; &nbsp; lCount = 1<br />
&nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> rRow.Rows.Hidden = <span class="kw1">False</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;aArr(lCount, i) = rRow<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">GoTo</span> Devo:<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
lCount = lCount + 1<br />
Devo:<br />
<span class="kw1">Next</span></p>
<p><span class="kw1">ReDim</span> <span class="kw1">Preserve</span> aArr(1 <span class="kw1">To</span> 3, 1 <span class="kw1">To</span> i)</p>
<p>aArr = Application.Transpose(aArr)<br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
<p>Good Luck</p>
<p>Devo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AlexJ</title>
		<link>http://www.dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/#comment-44432</link>
		<dc:creator>AlexJ</dc:creator>
		<pubDate>Tue, 09 Mar 2010 17:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3669#comment-44432</guid>
		<description>&lt;p&gt;I might be tempted to read the full (unfiltered) range into an array (to keep the number of sheet read actions down) and then put each row into a collection element, filtering out unwanted elements during the process.&lt;/p&gt;
&lt;p&gt;I tend to do my manipulations on the collection elements, then write to an array to load onto the sheet, but you could load the array from the collection before manipulation.&lt;/p&gt;
&lt;p&gt;I DO like geoff&#039;s SQL idea, though.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I might be tempted to read the full (unfiltered) range into an array (to keep the number of sheet read actions down) and then put each row into a collection element, filtering out unwanted elements during the process.</p>
<p>I tend to do my manipulations on the collection elements, then write to an array to load onto the sheet, but you could load the array from the collection before manipulation.</p>
<p>I DO like geoff&#8217;s SQL idea, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hans schraven</title>
		<link>http://www.dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/#comment-44425</link>
		<dc:creator>hans schraven</dc:creator>
		<pubDate>Tue, 09 Mar 2010 13:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3669#comment-44425</guid>
		<description>&lt;p&gt;I forgot&lt;/p&gt;
&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;With&lt;/span&gt; Sheets(1).usedrange&lt;br&gt;
&#160; .autofilter 1,&lt;span class=&quot;st0&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;br&gt;
&#160; .offset(1).specialcells(xlcelltypevisible).copy sheets(1).cells(1,27)&lt;br&gt;
&#160; .autofilter&lt;br&gt;
&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;
sq=sheets(1).cells(1,27).currentregion&lt;br&gt;
sheets(1).cells(1,27).currentregion.clearcontents&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>I forgot</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">With</span> Sheets(1).usedrange<br />
&nbsp; .autofilter 1,<span class="st0">&#8220;test&#8221;</span><br />
&nbsp; .offset(1).specialcells(xlcelltypevisible).copy sheets(1).cells(1,27)<br />
&nbsp; .autofilter<br />
<span class="kw1">End</span> <span class="kw1">with</span><br />
sq=sheets(1).cells(1,27).currentregion<br />
sheets(1).cells(1,27).currentregion.clearcontents</div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: hans schraven</title>
		<link>http://www.dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/#comment-44423</link>
		<dc:creator>hans schraven</dc:creator>
		<pubDate>Tue, 09 Mar 2010 13:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3669#comment-44423</guid>
		<description>&lt;p&gt;The simplest way:&lt;br&gt;
copy the cells to an empty space&lt;br&gt;
read the data there&lt;/p&gt;
&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;With&lt;/span&gt; Sheets(1).usedrange&lt;br&gt;
&#160; .autofilter 1,&lt;span class=&quot;st0&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;br&gt;
&#160; .offset(1).copy sheets(1).cells(1,27)&lt;br&gt;
&#160; .autofilter&lt;br&gt;
&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;
sq=sheets(1).cells(1,27).currentregion&lt;br&gt;
sheets(1).cells(1,27).currentregion.clearcontents&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>The simplest way:<br />
copy the cells to an empty space<br />
read the data there</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">With</span> Sheets(1).usedrange<br />
&nbsp; .autofilter 1,<span class="st0">&#8220;test&#8221;</span><br />
&nbsp; .offset(1).copy sheets(1).cells(1,27)<br />
&nbsp; .autofilter<br />
<span class="kw1">End</span> <span class="kw1">with</span><br />
sq=sheets(1).cells(1,27).currentregion<br />
sheets(1).cells(1,27).currentregion.clearcontents</div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: geoff</title>
		<link>http://www.dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/#comment-44416</link>
		<dc:creator>geoff</dc:creator>
		<pubDate>Tue, 09 Mar 2010 09:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3669#comment-44416</guid>
		<description>&lt;p&gt;Are you committed to using an autofilter? If not, an advanced filter extracting to a new range would do the trick. Or, a SQL query perhaps?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Are you committed to using an autofilter? If not, an advanced filter extracting to a new range would do the trick. Or, a SQL query perhaps?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Cone</title>
		<link>http://www.dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/#comment-44413</link>
		<dc:creator>Jim Cone</dc:creator>
		<pubDate>Tue, 09 Mar 2010 02:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3669#comment-44413</guid>
		<description>&lt;p&gt;&#039;Uses a variant array&lt;br&gt;
&#039;Uses the range that is auto filtered&lt;br&gt;
&#039;Transposes the filled array&lt;br&gt;
&#039;Me thinks you may have something else in mind?&lt;/p&gt;
&lt;p&gt;Sub ArrFilteredList2()&lt;/p&gt;
&lt;p&gt;    Dim rRow As Range&lt;br&gt;
    Dim vArr As Variant&lt;br&gt;
    Dim i As Long&lt;br&gt;
    Dim lCount As Long&lt;br&gt;
    Dim af As AutoFilter&lt;br&gt;
    Dim rng As Range&lt;/p&gt;
&lt;p&gt;    Set af = ActiveSheet.AutoFilter&lt;br&gt;
    Set rng = af.Range&lt;br&gt;
    Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1, rng.Columns.Count)&lt;br&gt;
    ReDim vArr(1 To 3, 1 To rng.Rows.Count)&lt;/p&gt;
&lt;p&gt;    For Each rRow In rng.Rows&lt;br&gt;
        If rRow.Hidden = False Then&lt;br&gt;
            lCount = lCount + 1&lt;br&gt;
            For i = 1 To 3&lt;br&gt;
                vArr(i, lCount) = rRow.Cells(i).Value&lt;br&gt;
            Next i&lt;br&gt;
        End If&lt;br&gt;
    Next rRow&lt;/p&gt;
&lt;p&gt;   ReDim Preserve vArr(1 To 3, 1 To lCount)&lt;br&gt;
   vArr = Application.Transpose(vArr)&lt;br&gt;
   &#039;Stop&lt;br&gt;
   MsgBox UBound(vArr, 1) &amp; vbCr &amp; UBound(vArr, 2)&lt;br&gt;
End Sub&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8216;Uses a variant array<br />
&#8216;Uses the range that is auto filtered<br />
&#8216;Transposes the filled array<br />
&#8216;Me thinks you may have something else in mind?</p>
<p>Sub ArrFilteredList2()</p>
<p>    Dim rRow As Range<br />
    Dim vArr As Variant<br />
    Dim i As Long<br />
    Dim lCount As Long<br />
    Dim af As AutoFilter<br />
    Dim rng As Range</p>
<p>    Set af = ActiveSheet.AutoFilter<br />
    Set rng = af.Range<br />
    Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count &#8211; 1, rng.Columns.Count)<br />
    ReDim vArr(1 To 3, 1 To rng.Rows.Count)</p>
<p>    For Each rRow In rng.Rows<br />
        If rRow.Hidden = False Then<br />
            lCount = lCount + 1<br />
            For i = 1 To 3<br />
                vArr(i, lCount) = rRow.Cells(i).Value<br />
            Next i<br />
        End If<br />
    Next rRow</p>
<p>   ReDim Preserve vArr(1 To 3, 1 To lCount)<br />
   vArr = Application.Transpose(vArr)<br />
   &#8216;Stop<br />
   MsgBox UBound(vArr, 1) &amp; vbCr &amp; UBound(vArr, 2)<br />
End Sub</p>
]]></content:encoded>
	</item>
</channel>
</rss>

