LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Iterating on several Cells within a Row

What you write is true. I'm not sure how it relates to my code fragment
posted and the issue I was having with it. Let me put a pair of comments in
the fragment to better explain:

For Each myRow In myRange.Rows
' is it a line we need to get the column data from?
If myRow.Cells(, ColX) = AmagicValue Then

' if it's magic, let's iterate on the cells of this row_
from column ColY to column ColZ
For Each myCell In myRow.Range( _
myRow.Cells(, ColY), _
myRow.Cells(, ColZ) _
).Cells
' do what we need to do with each of the _
subset of cells in our columns in the magic row
' problem was that here myCell.Address was pointing _
to a different row than myRow.Address, thus_
hosing everything up
Next myCell
End If
Next myRow

' problem wasn't a reference to myRow or _
myCell here outside of the For Each...

In any event, Jakob's posting sorted it out. Thanks for offering to help!

"Joel" wrote in message
...
No. See comments below.

For Each myRow In myRows.Rows
For Each myCell In myRow.Range( _
Next myCell
Next myRow

'this statement is not valid since myrow is outside the for loop
RowCount = myrow.row



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Iterating Thru Cells Kelvin Clayson Excel Programming 6 November 9th 04 06:33 PM
Iterating thru cells & comparing Kelvin Clayson Excel Programming 1 November 5th 04 07:12 PM
Iterating through cells problem heenchi[_2_] Excel Programming 1 June 9th 04 11:54 PM
Iterating through cells problem heenchi Excel Programming 1 June 9th 04 06:25 PM
Iterating through Cells .Net/Excel 2003 R Kalal Excel Programming 6 February 20th 04 01:13 AM


All times are GMT +1. The time now is 04:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"