Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Go to next row depending every nth iteration

I'm compiling data and writing it to a new sheet; it's a varying number of
rows each time I run the procedure, but for every procedure it's the same
number of rows. So, for instance, this time my data fills 7 rows (From A1
to A7 is a one-time 1-column only header-type column), then my loop fills
B-D, then E-G, etc.). I need to go down and start at A9 after my data
filling loops reaches 3 iterations. So if there are 12 sets of data I'm
looping through (this could change), I need to put set 1 in B-D, set 2 in
E-G, set 3 in H-J, then, because I've done 3 iterations, go down to A9, fill
A-C, D-F, H-I, now that's 3 iterations again, so I need to go down to A-16,
etc.

I tried using 2 dependent counters, where one goes up one for every
iteration, then the other goes up one when the first one has gone up 2, but
it's not working, and I think my logic is flawed as well.

Can someone suggest a good way to do this?

Thanks for your help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Go to next row depending every nth iteration

I figured it out. If anyone else runs into this, assume for the following
that you do one thing every iteration of a loop, but want to do something in
addition every 3 iterations of a loop:

Counter 1 = 0
Counter 2 = 0

Do

If Counter 1 = Counter2 + 3 then

'Code you do every 3 times

Counter 2 = Counter1

End if

'Code you do every iteration

Counter1 = Counter1 + 1

Loop Until [whatever]



"CompleteNewb" wrote in message
...
I'm compiling data and writing it to a new sheet; it's a varying number of
rows each time I run the procedure, but for every procedure it's the same
number of rows. So, for instance, this time my data fills 7 rows (From A1
to A7 is a one-time 1-column only header-type column), then my loop fills
B-D, then E-G, etc.). I need to go down and start at A9 after my data
filling loops reaches 3 iterations. So if there are 12 sets of data I'm
looping through (this could change), I need to put set 1 in B-D, set 2 in
E-G, set 3 in H-J, then, because I've done 3 iterations, go down to A9,
fill A-C, D-F, H-I, now that's 3 iterations again, so I need to go down to
A-16, etc.

I tried using 2 dependent counters, where one goes up one for every
iteration, then the other goes up one when the first one has gone up 2,
but it's not working, and I think my logic is flawed as well.

Can someone suggest a good way to do this?

Thanks for your help.


Reply
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
Iteration Khalil[_2_] Excel Worksheet Functions 4 June 19th 09 08:21 PM
Iteration Alan Beban[_2_] Excel Programming 2 November 3rd 07 07:30 AM
iteration Gareth Milton Excel Discussion (Misc queries) 1 March 28th 07 04:18 PM
Need help with iteration Ron M. Excel Discussion (Misc queries) 7 March 14th 06 12:32 AM
Iteration M. Homayon Excel Discussion (Misc queries) 1 January 11th 06 01:05 AM


All times are GMT +1. The time now is 02:20 AM.

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"