Re: Do Loop until empty row (column "A")




Rows P - Y still empty with modification below. Any suggestions? It
appears the loops is not executing with the following code.

Jim


Range("P2").Select
'
' Start of row calculations.
'
Dim rng As Range, i As Long
i = 2
Set rng = Cells(i, 1)
Do While (Selection.Offset(1, 0) <> "")
'
' Calculate columns P - Y.
'
Cells(ActiveCell.Row, "P").FormulaR1C1 = "=IF(RC[-7]=0,""
"",(RC[-6]*1000)/RC[-7])"
Cells(ActiveCell.Row, "Q").FormulaR1C1 = _
"=IF((RC[-8]+RC[-6])=0,"" "",(RC[-7]*1000)/(RC[-8]+RC[-6]))"
Cells(ActiveCell.Row, "R").FormulaR1C1 = "=IF(RC[-9]=0,""
"",RC[-7]/RC[-9])"
Cells(ActiveCell.Row, "S").FormulaR1C1 = _
"=IF((RC[-10]+RC[-8])=0,"" "",RC[-8]/(RC[-10]+RC[-8]))"
Cells(ActiveCell.Row, "T").FormulaR1C1 = "=IF(RC[-11]=0,""
"",RC[-10]/RC[-11])"
Cells(ActiveCell.Row, "U").FormulaR1C1 = "=IF(RC[-11]=0,""
"",RC[-12]/RC[-11])"
Cells(ActiveCell.Row, "V").FormulaR1C1 = "=IF(RC[-12]=0,""
"",RC[-11]/RC[-12])"
Cells(ActiveCell.Row, "W").FormulaR1C1 = "=SUM(RC[-14]/30)"
Cells(ActiveCell.Row, "X").FormulaR1C1 = "=SUM(RC[-14]/30)"
Cells(ActiveCell.Row, "Y").FormulaR1C1 = "=SUM(RC[-14]/30)"
'
' Next row.
'
i = i + 1
Set rng = rng.Offset(1, 0)
Loop


--
Jim15
------------------------------------------------------------------------
Jim15's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=26300
View this thread: http://www.excelforum.com/showthread.php?threadid=395789

.



Relevant Pages

  • RE: need help
    ... doing Loops within Loops. ... "Jim May" wrote: ... RowCount = RowCount + 1 ... one part number to the next part number there are empty box, the empty row ...
    (microsoft.public.excel.misc)
  • Re: Way, way OT: PC stuff/rant
    ... >>> One taco short of a combination plate ... >>> Belt doesn't go through all of the loops ... >>> Jim ...
    (rec.food.cooking)
  • Re: How can i simplify this messy for loop???!!!
    ... > certain columns of my H matrix to zero. ... independent for loops, not one nested set. ... % once for each value of col_1 (you are executing it thousands ... I left it as col_1, col_2, etc. for readability. ...
    (comp.soft-sys.matlab)
  • Re: unformatted file
    ... Jim wrote: ... back with implied do-loops. ... The implied DO loops aren't actually the problem. ... It is the explicit DO loops that are the problem, ...
    (comp.lang.fortran)
  • ECLiPSe with nested loops
    ... It breaks out of all loops upon executing the first line on the ... innermost loop. ... Or more practically how does one iterate over a number of variables? ...
    (comp.lang.prolog)