<?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>nandeshwar.info &#187; filter</title>
	<atom:link href="http://nandeshwar.info/tag/filter/feed/" rel="self" type="application/rss+xml" />
	<link>http://nandeshwar.info</link>
	<description></description>
	<lastBuildDate>Mon, 12 Dec 2011 21:33:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Auto Filter Cursor Movement</title>
		<link>http://nandeshwar.info/2009/06/01/auto-filter-cursor-movement/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=auto-filter-cursor-movement</link>
		<comments>http://nandeshwar.info/2009/06/01/auto-filter-cursor-movement/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 19:09:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[filter]]></category>

		<guid isPermaLink="false">http://nandeshwar.info/?p=250</guid>
		<description><![CDATA[Don&#8217;t you hate it when you are working with many fields and you want to filter a particular field, so you apply auto filter on the all fields, but you find out that the field you were working on is gone from your sight and you see A1 cell. I did. Not anymore. Solution: Simply [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t you hate it when you are working with many fields and you want to filter a particular field, so you apply auto filter on the all fields, but you find out that the field you were working on is gone from your sight and you see A1 cell. I did. Not anymore.</p>
<p><strong>Solution</strong>: Simply hit the left or the right arrow key, and it will take you to the left or the right cell of the field you were working on.</p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2009/06/01/auto-filter-cursor-movement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Sheets based on a Column</title>
		<link>http://nandeshwar.info/2008/11/10/create-sheets-based-on-a-column/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-sheets-based-on-a-column</link>
		<comments>http://nandeshwar.info/2008/11/10/create-sheets-based-on-a-column/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 16:30:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Create Sheets]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[Range Cells]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2008/11/10/create-sheets-based-on-a-column/</guid>
		<description><![CDATA[Ever felt the need of creating different sheets based on the distinct values of a column. For example, in your data, you have a column called STATE, and you would like to create a separate sheet for each state with all the data from that state. Here&#8217;s your solution then:(Note: you&#8217;ll need to add a [...]]]></description>
			<content:encoded><![CDATA[<p>Ever felt the need of creating different sheets based on the distinct values of a column. For example, in your data, you have a column called STATE, and you would like to create a separate sheet for each state with all the data from that state. Here&#8217;s your solution then:<br />(Note: you&#8217;ll need to add a UDF function UniqueItems from http://j-walk.com/ss/excel/tips/tip15.htm)</p>
<p>This procedure will create a new sheet for each unique item in the selected column with the data from the main sheet for that unique item. As an added bonus, the procedure will sort the sheets ascending (Courtesy:ozgrid.com) <br /><font face="Courier"><span style="color:#007F00;">&#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span><br /><span style="color:#007F00;">&#8216; Procedure : CreateSheetsColumn</span><br /><span style="color:#007F00;">&#8216; DateTime&#160;&#160;: 11/10/2008 09:32</span><br /><span style="color:#007F00;">&#8216; Author&#160;&#160;&#160;&#160;: ARN</span><br /><span style="color:#007F00;">&#8216; Purpose&#160;&#160; : To create sheets with the data from the main sheet based on a selected column.</span><br /><span style="color:#007F00;">&#8216;Assumptions:</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8217;1 -&#160;&#160;data are in contigious form</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8217;2 &#8211; the unique column does not have any special characters</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8217;3 &#8211; the first row is the header row</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8217;4 &#8211; the only sheet in the workbook is the data workbook</span><br /><span style="color:#007F00;">&#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span><br /><span style="color:#007F00;">&#8216;</span><br /><span style="color:#00007F;">Public</span> <span style="color:#00007F;">Sub</span> CreateSheetsColumn()</p>
<p><span style="color:#00007F;">On</span> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> CreateSheetsColumn_Error<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Dim</span> rngInput <span style="color:#00007F;">As</span> Range, rngColAddr <span style="color:#00007F;">As</span> Range, varrUniqueVals() <span style="color:#00007F;">As</span> <span style="color:#00007F;">Variant</span>, dCounter <span style="color:#00007F;">As</span> <span style="color:#00007F;">Double</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Dim</span> rngCol <span style="color:#00007F;">As</span> Range<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Dim</span> dUniqueItems <span style="color:#00007F;">As</span> <span style="color:#00007F;">Double</span>, dColtoFilterOn <span style="color:#00007F;">As</span> <span style="color:#00007F;">Double</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Dim</span> lCount <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span>, lShtLast <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span>, lCount2 <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;Set the working range</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Set</span> rngInput = ActiveSheet.Range(Cells(1, 1), Cells(1, 1).SpecialCells(xlLastCell))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;get the column to work on from the user</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Set</span> rngColAddr = Application.InputBox(prompt:=&#8221;Select the column that would be used to create distinct sheets&#8221;, _<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Title:=&#8221;Select a Column&#8221;, _<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Type:=8)<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;if more than one column is selected, exit</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">If</span> rngColAddr.Columns.Count &gt; 1 <span style="color:#00007F;">Then</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MsgBox &#8220;Too many columns; select only one column&#8221;, vbOKOnly<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Sub</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">End</span> <span style="color:#00007F;">If</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;set the application screen updating to false to increase execution speed</span><br />&#160;&#160;&#160;&#160;Application.ScreenUpdating = <span style="color:#00007F;">False</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;store the column number in a variable</span><br />&#160;&#160;&#160;&#160;dColtoFilterOn = rngColAddr.Column<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;set a range from the 2nd row to the last row from the selected column to get the distinct values</span><br />&#160;&#160;&#160;&#160;Set rngCol = ActiveSheet.Range(Cells(2, dColtoFilterOn), Cells(rngInput.Rows.Count, dColtoFilterOn))<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;use the function UniqueItems (http://j-walk.com/ss/excel/tips/tip15.htm) to get unique values from the selected column</span><br />&#160;&#160;&#160;&#160;varrUniqueVals = UniqueItems(rngCol, <span style="color:#00007F;">False</span>)<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;get the total number of unique items</span><br />&#160;&#160;&#160;&#160;dUniqueItems = <span style="color:#00007F;">UBound</span>(varrUniqueVals, 1)<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;start a loop to filter the range on each unique item</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">For</span> dCounter = 1 <span style="color:#00007F;">To</span> dUniqueItems<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216; only if the unique value is not blank</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">If</span> <span style="color:#00007F;">Not</span> varrUniqueVals(dCounter) = &#8220;&#8221; <span style="color:#00007F;">Then</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216; apply filter</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rngInput.AutoFilter Field:=dColtoFilterOn, Criteria1:=varrUniqueVals(dCounter)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;add a new sheet</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Sheets.Add After:=Sheets(Sheets.Count)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;rename the sheet</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ActiveSheet.Name = varrUniqueVals(dCounter)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;"<br />
>&#8216;copy the filtered data</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rngInput.Copy Destination:=Worksheets(varrUniqueVals(dCounter)).Range(&#8220;A1&#8243;)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;remove copy</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Application.CutCopyMode = <span style="color:#00007F;">False</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">End</span> <span style="color:#00007F;">If</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Next</span> dCounter<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;remove filter</span><br />&#160;&#160;&#160;&#160;rngInput.AutoFilter<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216; Sort sheets ascending &#8211; except the first one</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216; copied from http://www.ozgrid.com/VBA/sort-sheets.htm</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;lShtLast = Sheets.Count<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">For</span> lCount = 2 <span style="color:#00007F;">To</span> lShtLast<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">For</span> lCount2 = lCount <span style="color:#00007F;">To</span> lShtLast<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">If</span> UCase(Sheets(lCount2).Name) &lt; UCase(Sheets(lCount).Name) <span style="color:#00007F;">Then</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Sheets(lCount2).Move Before:=Sheets(lCount)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">End</span> <span style="color:#00007F;">If</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">Next</span> lCount2<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">Next</span> lCount<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />MsgBox &#8220;Done&#8221;</p>
<p><span style="color:#00007F;">On</span> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> 0<br />SmoothExit_CreateSheetsColumn:</p>
<p>&#160;&#160;&#160;&#160;Application.ScreenUpdating = <span style="color:#00007F;">True</span></p>
<p>&#160;&#160;&#160;&#160;<span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Sub</span></p>
<p>CreateSheetsColumn_Error:<br />&#160;&#160;&#160;&#160;MsgBox &#8220;Error &#8221; &amp; Err.Number &amp; &#8221; (&#8221; &amp; Err.Description &amp; &#8220;) in Sub:CreateSheetsColumn&#8221;<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Resume</span> SmoothExit_CreateSheetsColumn<br /><span style="color:#00007F;">End</span> <span style="color:#00007F;">Sub</span><br /></font></p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2008/11/10/create-sheets-based-on-a-column/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

