Re: Do Loop until empty row (column "A")
- From: Jim15 <Jim15.1ttf6d_1124125559.223@xxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 15 Aug 2005 11:12:52 -0500
The last thread code did not work. I am using Range "P2" to start the
calculations in P2 and continue through Y2, then go to P3 through Y3,
etc. until the last row is reached. It is looping until the last row
but not filling out columns P - Y. Once finished, it displays
"#VALUE!" in P2 cell with the formulate B2/30 which should be in Y2.
Thanks,
Jim
Range("P2").Select
'
' Start of row calculations.
'
Dim rng As Range, i As Long
i = 2
Set rng = Cells(i, 1)
Do While Application.CountA(rng.Resize(1, 15)) <> 0
'
' Calculate columns P - Y (10 columns)
'
ActiveCell.FormulaR1C1 = "=IF(RC[-7]=0,""
"",(RC[-6]*1000)/RC[-7])"
ActiveCell.FormulaR1C1 = _
"=IF((RC[-8]+RC[-6])=0,"" "",(RC[-7]*1000)/(RC[-8]+RC[-6]))"
ActiveCell.FormulaR1C1 = "=IF(RC[-9]=0,"" "",RC[-7]/RC[-9])"
ActiveCell.FormulaR1C1 = _
"=IF((RC[-10]+RC[-8])=0,"" "",RC[-8]/(RC[-10]+RC[-8]))"
ActiveCell.FormulaR1C1 = "=IF(RC[-11]=0,""
"",RC[-10]/RC[-11])"
ActiveCell.FormulaR1C1 = "=IF(RC[-11]=0,""
"",RC[-12]/RC[-11])"
ActiveCell.FormulaR1C1 = "=IF(RC[-12]=0,""
"",RC[-11]/RC[-12])"
ActiveCell.FormulaR1C1 = "=SUM(RC[-14]/30)"
ActiveCell.FormulaR1C1 = "=SUM(RC[-14]/30)"
ActiveCell.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
.
- Follow-Ups:
- Re: Do Loop until empty row (column "A")
- From: Jim15
- Re: Do Loop until empty row (column "A")
- References:
- Do Loop until empty row (column "A")
- From: Jim15
- Re: Do Loop until empty row (column "A")
- From: Tom Ogilvy
- Do Loop until empty row (column "A")
- Prev by Date: Re: Splash Screen Causing Problems
- Next by Date: Re: Renamed EditBoxes keep reverting to their old names in UserFor
- Previous by thread: Re: Do Loop until empty row (column "A")
- Next by thread: Re: Do Loop until empty row (column "A")
- Index(es):
Relevant Pages
|