View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JW[_2_] JW[_2_] is offline
external usenet poster
 
Posts: 638
Default Making calculations down one column while moving down another

To keep the formula intact:
Sub testHere()
For i = 5 To Cells(Rows.Count, 1).End(xlUp).Row
Cells(i, 3).FormulaR1C1 = "=RC[10]-R[-1]C[10]"
Next i
End Sub

To not keep the formula:
Sub testAgain()
For i = 5 To Cells(Rows.Count, 1).End(xlUp).Row
Cells(i, 3).Value = Cells(i, 13).Value - _
Cells(i, 13).Offset(-1, 0).Value
Next i
End Sub
JV wrote:
Hello,

First I need to move down a column starting at A5 until there is no data in
a row to identify the numbers of rows . As I am moving down the row, I need
to calculate cell C5 = M5-M4. Then cell C6=M6-M5 and so on.

Thanks in advance,
JV