View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Simon Murphy[_3_] Simon Murphy[_3_] is offline
external usenet poster
 
Posts: 8
Default Change range multiple times

Jim
You could try something like

dim i as integer
dim cl as range

for i = 0 to 7
for each cl in Range("D3:J23").offset(0,i).cells
'do your stuff
next cl
next i

I'm not totally sure what you are after but I think offset
may do what you want, there may be better ways

cheers
simon
-----Original Message-----
I'm using the following statement:

For Each Cell In Range("D3:J23")

I want the range in the For Next statement to move 8

colums to the
right and run again. Same row numbers. I need this to

happen 20 times.


Then I want to increase each If Range value by 1 each

time it loops.
Same column numbers. This is also 20 times.To avoid

writing out like
this:

If Range("I29").Value = Range("I26") And Cell.Value ""

And
Cells(Cell.Row, "AO") = "x" Then _
Cell.Value = Range("AO1")

If Range("I30").Value = Range("I27") And Cell.Value ""

And
Cells(Cell.Row, "AO") = "x" Then _
Cell.Value = Range("AO1")

If Range("H29").Value = Range("H26") And Cell.Value ""

And
Cells(Cell.Row, "AN") = "x" Then _
Cell.Value = Range("AN1")

If Range("H30").Value = Range("H27") And Cell.Value ""

And
Cells(Cell.Row, "AN") = "x" Then _
Cell.Value = Range("AN1")
etc.

Thanks
Jim


---
Message posted from http://www.ExcelForum.com/

.