View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] garyusenet@myway.com is offline
external usenet poster
 
Posts: 33
Default Multiple For/Next Loop help

Hello. Can somebody suggest a revised version of the following code
please: -

For I = 6 To ilastcolumn Step 42
For j = 7 To ilastcolumn Step 42
For k = 9 To ilastcolumn Step 42
For l = 35 To ilastcolumn Step 42
For m = 37 To ilastcolumn Step 42
For n = 38 To ilastcolumn Step 42
For o = 40 To ilastcolumn Step 42
For p = 41 To ilastcolumn Step 42
For q = 42 To ilastcolumn Step 42

textstring = (Cells(ActiveCell.Row, I).Value) & " " &
(Cells(ActiveCell.Row, j).Value) _
& " " & (Cells(ActiveCell.Row, k).Value) & " " & (Cells(ActiveCell.Row,
l).Value) _
& " " & (Cells(ActiveCell.Row, m).Value) & " " & (Cells(ActiveCell.Row,
n).Value) _
& " " & (Cells(ActiveCell.Row, o).Value) & " " & (Cells(ActiveCell.Row,
p).Value) _
& " " & (Cells(ActiveCell.Row, q).Value) & Chr(10)


Next q
Next p
Next o
Next n
Next m
Next l
Next k
Next j
Next I

I need every variable from i-q incrememented by it's next value each
time the (textstring = .. ) statement is encountered. I tried to
achieve that with the above code but i think i've coded it wrong, i
think instead of that what is actually happening is each variable is
going through it's increment cycle independently of the other over
variables before moving on to the next variable, which is running it's
own incremement cycle.

Any ideas how I get all the variables to incremement to there next
value at the same time?

thanks,

Gary.