Home |
Search |
Today's Posts |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
loop help
I haven't tested this, but what if you had a second variable (call it "x") as a counter and a third variable (call it "y") that is the number of times to loop? For example:
Dim x as Long Dim y as long x = 0 y = keyend - keystart For i = keystart + 1 To keyend if x = y then GoTo Continue x = x + 1 Range("n" & i).Value = step1 & "-" & step2 Range("o" & i).Formula = "=COUNTIF(H:H, ""<=" & step2 & " "")-COUNTIF(H:H, ""<" & step1 & """)" With Range("q" & i) .Formula = "=p" & i & "/p" & keyend + 1 .NumberFormat = "0.00%" End With With Range("p" & i) .Formula = "=SUMIF(H:H, ""<=" & step2 & " "",I:I )-SUMIF(H:H, ""<" & step1 & """,I:I)" .Style = "currency" End With If Range("p" & i).Value = 0 Then Range("n" & i & ":q" & i).Value = "" '''' This blanks out the line, which is good i = i - 1 '''' This makes me re-run the loop on the same row, which is good, but i will never equal keyend, End If step1 = step2 + 1 step2 = step2 + 5 Next i Continue: |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
returning back to loop check condition without completing the loop | Excel Programming | |||
Loop to Filter, Name Sheets. If Blank, Exit Loop | Excel Programming | |||
(Complex) Loop within loop to create worksheets | Excel Programming | |||
Advancing outer Loop Based on criteria of inner loop | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming |