Looping several columns

1. Junior Member
Join Date
Dec 1969
Posts
12

## Looping several columns

Problem!<BR><BR>I would like to know how to loop a 1 dimension array into 3 columns looping 1 column at a time (html-table).<BR><BR>I already know how to loop columns row by row but the sortoder is wrong then.<BR><BR>This is how I would like it to show:<BR>A E I<BR>B F J<BR>C G K<BR>D H L<BR><BR>And NOT like this (this I know how to do):<BR>A B C<BR>D E F<BR>G H I<BR>J K L<BR><BR>Please help me!

2. Senior Member
Join Date
Dec 1969
Posts
497

## RE: Looping several columns

Use UBound on the array to get the maxArray entry.<BR><BR>dim arry<BR><BR>columns = 3<BR>maxEntry = UBound(arry)<BR>&#039;ceiling function<BR>if Int(maxEntry/columns)&#060;(maxEntry/columns) then<BR>rows = Int(maxEntry/columns) + 1<BR>else<BR>rows = Int(maxEntry/columns)<BR>end if<BR><BR>for i = 0 to rows<BR>for j = 0 to columns-1<BR>response.write arry(i + (j*rows))<BR>next<BR>response.write "&#060; b r &#062;"<BR>next<BR><BR>I have not tested this... let me know if it bugs out<BR><BR>sponge

3. Junior Member
Join Date
Dec 1969
Posts
12

## RE: Looping several columns

Works great! Can&#039;t believe I couldĀ“nt work that out by myself!<BR><BR>Thanks!!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•