Thread: For each
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default For each

Does this mean you're looking for the value 32 in one of the cells?
Or does it mean you're looking at the 32nd cell in that range?

And if it's the 32nd cell in the range, how do you want to loop?
through rows, then columns (all of row 3 before going to row 4, ...)
or
through columns, then rows (all of column C, then column D, ...)
or
some random loop <vbg.

JMay wrote:

I've assigned a Obj variable: Set oRng=C3:P84 (there are 84 elements/items)
So I then have

Dim c as Range
'code
For each c in oRng

Next c

As I step thru the code I need to perform an action when (using IF)
c reaches element, say 32 -- How is this done using the For each method?
I know I could assign a counter i (and do the i = i + 1 inside), but is that
necessary using the For each.

Thanks in advance..

Jim


--

Dave Peterson