i have this for next:
for k=0 to 2
...
next k
and i need to increase from 3000 this block:
0 - 3000
3001 - 6000
6001 - 9000
how to increase the block in the loop of for next?
eaxmple:
for k=0 frist block 0 - 3000
for k=1 frist block 3001 - 6000
for k=2 frist block 6001 - 9000
logical for next
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
logical for next
Last edited by sal21 on 02 Aug 2013, 10:58, edited 1 time in total.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: logical for next
Your question does not make sense as it does not conform to the loop structure.
What do you mean by increase the block?
What do you mean by increase the block?
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78527
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: logical for next
As Rudi says, you'll have to provide more information. What do you want to do with the 'blocks'?
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
Re: logical for next
from 0 - to 3000HansV wrote:As Rudi says, you'll have to provide more information. What do you want to do with the 'blocks'?
from 3001 - to 6000
from 6001 - to 9000
-
- Administrator
- Posts: 78527
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
Re: logical for next
in effect i need a for next cylcle with a steep of 3000 + 3000...HansV wrote:But what do you want to do?
0 3000
3001 6000
6001 9000
-
- Administrator
- Posts: 78527
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: logical for next
Do you want something like this?
Note that the first "block" will be from 1 to 3000, not from 0 to 3000.
Code: Select all
Dim k As Long
Dim j As Long
For k = 0 To 2
For j = 3000 * k + 1 to 3000 * k + 3000
' your code here
...
Next j
Next k
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4362
- Joined: 26 Apr 2010, 17:36
Re: logical for next
HansV wrote:Do you want something like this?
Note that the first "block" will be from 1 to 3000, not from 0 to 3000.Code: Select all
Dim k As Long Dim j As Long For k = 0 To 2 For j = 3000 * k + 1 to 3000 * k + 3000 ' your code here ... Next j Next k
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: logical for next
Very nice...HansV wrote:Do you want something like this?
Note that the first "block" will be from 1 to 3000, not from 0 to 3000.Code: Select all
Dim k As Long Dim j As Long For k = 0 To 2 For j = 3000 * k + 1 to 3000 * k + 3000 ' your code here ... Next j Next k
Multiplying with the outer loop is a great move.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.