PDA

View Full Version : Solved: looping backwards using steps



choubix
06-26-2008, 07:23 PM
hello,

a quick question on looping backwards using steps.
I have this loop:


For k = Total_Days + 1 To 1 Step -Fixings


Let say Total_Days = 66 et Fixings = 22
my loop returns a result every 22 rows:
1 result at row 66, anothe rone at row 44 and last one at row 22.

I need to introduce a "Guarantee" feature.
Let's say "Guarantee" = 1
I now need to return results only at row 66 and 44.

if "Guarantee" = 2
I should get results at row 66 only

does anyone have an idea on how to get this to work please?

thx

choubix
06-26-2008, 08:55 PM
got it :)



For k = Total_Days To 1 Step -Fixings
If Guarantee <> 0 And k - 1 <= Guarantee * Fixings Or k = 1 Then
wsOutput.Cells(k, 2) = "grumpf"
Else
wsOutput.Cells(k, 2) = "test"