Go to next row depending every nth iteration

C

CompleteNewb

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.
 
C

CompleteNewb

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top