Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Looping
I'm trying to create a loop that will stop at the first blank line, then skip
4 lines and start the loop again. So far the first loop works great. I have trouble with it trying to restart the loop after it skips four lines. Can anyone Help!!!!!! This is what i have for the first loop. Sub CalculateVariance() Dim i As Integer i = 11 Do Until IsEmpty(Cells(i, 9)) Cells(i, 17).Formula = "=rc[-8]-rc[-4]" Cells(i, 18).Formula = "=rc[-8]-rc[-4]" Cells(i, 19).Formula = "=rc[-8]-rc[-4]" i = i + 1 Loop |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Looping
Try this:
Sub CalculateVariance() Dim i As Integer i = 11 Do Until IsEmpty(Cells(i, 9)) Cells(i, 17).Formula = "=rc[-8]-rc[-4]" Cells(i, 18).Formula = "=rc[-8]-rc[-4]" Cells(i, 19).Formula = "=rc[-8]-rc[-4]" i = i + 1 Loop i = i + 4 Do Until IsEmpty(Cells(i, 9)) Cells(i, 17).Formula = "=rc[-8]-rc[-4]" Cells(i, 18).Formula = "=rc[-8]-rc[-4]" Cells(i, 19).Formula = "=rc[-8]-rc[-4]" i = i + 1 Loop "David T" wrote: I'm trying to create a loop that will stop at the first blank line, then skip 4 lines and start the loop again. So far the first loop works great. I have trouble with it trying to restart the loop after it skips four lines. Can anyone Help!!!!!! This is what i have for the first loop. Sub CalculateVariance() Dim i As Integer i = 11 Do Until IsEmpty(Cells(i, 9)) Cells(i, 17).Formula = "=rc[-8]-rc[-4]" Cells(i, 18).Formula = "=rc[-8]-rc[-4]" Cells(i, 19).Formula = "=rc[-8]-rc[-4]" i = i + 1 Loop |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Looping
Christopher-
THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!! It worked like a charm.... You're the best man "ChristopherTri" wrote: Try this: Sub CalculateVariance() Dim i As Integer i = 11 Do Until IsEmpty(Cells(i, 9)) Cells(i, 17).Formula = "=rc[-8]-rc[-4]" Cells(i, 18).Formula = "=rc[-8]-rc[-4]" Cells(i, 19).Formula = "=rc[-8]-rc[-4]" i = i + 1 Loop i = i + 4 Do Until IsEmpty(Cells(i, 9)) Cells(i, 17).Formula = "=rc[-8]-rc[-4]" Cells(i, 18).Formula = "=rc[-8]-rc[-4]" Cells(i, 19).Formula = "=rc[-8]-rc[-4]" i = i + 1 Loop "David T" wrote: I'm trying to create a loop that will stop at the first blank line, then skip 4 lines and start the loop again. So far the first loop works great. I have trouble with it trying to restart the loop after it skips four lines. Can anyone Help!!!!!! This is what i have for the first loop. Sub CalculateVariance() Dim i As Integer i = 11 Do Until IsEmpty(Cells(i, 9)) Cells(i, 17).Formula = "=rc[-8]-rc[-4]" Cells(i, 18).Formula = "=rc[-8]-rc[-4]" Cells(i, 19).Formula = "=rc[-8]-rc[-4]" i = i + 1 Loop |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looping Question | Excel Discussion (Misc queries) | |||
Looping between sheets picking up values on the way | Excel Worksheet Functions | |||
Looping in VB with cell ranges | Excel Worksheet Functions | |||
looping question | New Users to Excel | |||
Looping macros using VB code | Excel Discussion (Misc queries) |