<?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: VBA: Loop Through a Range</title>
	<atom:link href="http://www.automateexcel.com/2004/08/14/excel_vba_loop_through_a_range/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.automateexcel.com/2004/08/14/excel_vba_loop_through_a_range/</link>
	<description>Everything Excel. Only Excel.</description>
	<lastBuildDate>Mon, 21 Nov 2011 07:25:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: rahul</title>
		<link>http://www.automateexcel.com/2004/08/14/excel_vba_loop_through_a_range/comment-page-1/#comment-1609</link>
		<dc:creator>rahul</dc:creator>
		<pubDate>Wed, 14 Jul 2010 20:55:20 +0000</pubDate>
		<guid isPermaLink="false">#comment-1609</guid>
		<description>can anyone tell me what is wrong in this code. after inserting columns it is going back to insert statement and throwing &quot;insert method range error&quot;. Please giv any suggestions.


Private Sub ComboBox1_Change()
Sheet1.Unprotect

Dim LastRowColA As Range
Dim abc As Range
If ComboBox1.Text = &quot;Food&quot; Then
Worksheets(&quot;Sheet3&quot;).Activate
    Sheet1.Unprotect
Set LastRowColA = Sheet2.Range(&quot;J3&quot;)

Set abc = Sheet2.Range(&quot;J2&quot;).End(xlDown)
   
  Set Rng = Sheet2.Range(LastRowColA, abc)
  Sheet1.Activate
  For Each d In Rng.Cells
    ActiveCell = CStr(d.Value)
  Sheet1.Cells(17, 22).EntireColumn.Insert shift:=xlLeft
    
Next d

ElseIf ComboBox1.Text = &quot;Drink&quot; Then
Worksheets(&quot;Sheet3&quot;).Activate
    Sheet1.Unprotect
Set LastRowColA = Sheet2.Range(&quot;M3&quot;)

Set abc = Sheet2.Range(&quot;M2&quot;).End(xlDown)
   
  Set Rng = Sheet2.Range(LastRowColA, abc)
   Sheet1.Activate
  For Each d In Rng.Cells
     ActiveCell = CStr(d.Value)
    
  Sheet1.Cells(17, 22).EntireColumn.Insert shift:=xlLeft
    
Next d

End If

End Sub</description>
		<content:encoded><![CDATA[<p>can anyone tell me what is wrong in this code. after inserting columns it is going back to insert statement and throwing &#8220;insert method range error&#8221;. Please giv any suggestions.</p>
<p>Private Sub ComboBox1_Change()<br />
Sheet1.Unprotect</p>
<p>Dim LastRowColA As Range<br />
Dim abc As Range<br />
If ComboBox1.Text = &#8220;Food&#8221; Then<br />
Worksheets(&#8220;Sheet3&#8243;).Activate<br />
    Sheet1.Unprotect<br />
Set LastRowColA = Sheet2.Range(&#8220;J3&#8243;)</p>
<p>Set abc = Sheet2.Range(&#8220;J2&#8243;).End(xlDown)</p>
<p>  Set Rng = Sheet2.Range(LastRowColA, abc)<br />
  Sheet1.Activate<br />
  For Each d In Rng.Cells<br />
    ActiveCell = CStr(d.Value)<br />
  Sheet1.Cells(17, 22).EntireColumn.Insert shift:=xlLeft</p>
<p>Next d</p>
<p>ElseIf ComboBox1.Text = &#8220;Drink&#8221; Then<br />
Worksheets(&#8220;Sheet3&#8243;).Activate<br />
    Sheet1.Unprotect<br />
Set LastRowColA = Sheet2.Range(&#8220;M3&#8243;)</p>
<p>Set abc = Sheet2.Range(&#8220;M2&#8243;).End(xlDown)</p>
<p>  Set Rng = Sheet2.Range(LastRowColA, abc)<br />
   Sheet1.Activate<br />
  For Each d In Rng.Cells<br />
     ActiveCell = CStr(d.Value)</p>
<p>  Sheet1.Cells(17, 22).EntireColumn.Insert shift:=xlLeft</p>
<p>Next d</p>
<p>End If</p>
<p>End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bhanu</title>
		<link>http://www.automateexcel.com/2004/08/14/excel_vba_loop_through_a_range/comment-page-1/#comment-1345</link>
		<dc:creator>Bhanu</dc:creator>
		<pubDate>Mon, 19 Oct 2009 13:12:52 +0000</pubDate>
		<guid isPermaLink="false">#comment-1345</guid>
		<description>Please give me the code to populate the recordset data into the excel file,where record set is having the data of 80,000 rows and having 500 columns.

Please help me.

Thanks</description>
		<content:encoded><![CDATA[<p>Please give me the code to populate the recordset data into the excel file,where record set is having the data of 80,000 rows and having 500 columns.</p>
<p>Please help me.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rishi doshi</title>
		<link>http://www.automateexcel.com/2004/08/14/excel_vba_loop_through_a_range/comment-page-1/#comment-1190</link>
		<dc:creator>rishi doshi</dc:creator>
		<pubDate>Wed, 29 Apr 2009 11:04:15 +0000</pubDate>
		<guid isPermaLink="false">#comment-1190</guid>
		<description>Hi,
How to manually increment while using FOR EACH?
e.g.
for each cell in range(abc)
  if cell.value = &quot;YES&quot; then
  --&gt;{increment cell = cell + 5}
  end if
next
    
we do it in normal FOR loops
like.. if {something} then i = i+5

I would like to achieve the same while using the FOR EACH loop
thanks in advance!

Rishi</description>
		<content:encoded><![CDATA[<p>Hi,<br />
How to manually increment while using FOR EACH?<br />
e.g.<br />
for each cell in range(abc)<br />
  if cell.value = &#8220;YES&#8221; then<br />
  &#8211;&gt;{increment cell = cell + 5}<br />
  end if<br />
next</p>
<p>we do it in normal FOR loops<br />
like.. if {something} then i = i+5</p>
<p>I would like to achieve the same while using the FOR EACH loop<br />
thanks in advance!</p>
<p>Rishi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kent</title>
		<link>http://www.automateexcel.com/2004/08/14/excel_vba_loop_through_a_range/comment-page-1/#comment-961</link>
		<dc:creator>Kent</dc:creator>
		<pubDate>Tue, 21 Oct 2008 04:55:08 +0000</pubDate>
		<guid isPermaLink="false">#comment-961</guid>
		<description>dear sir,

in the first example, you forget to put the End Sub at the end of the program.

I learn something from this program. Thanks</description>
		<content:encoded><![CDATA[<p>dear sir,</p>
<p>in the first example, you forget to put the End Sub at the end of the program.</p>
<p>I learn something from this program. Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

