ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   placing calculation based on two sum fields in loop (https://www.excelbanter.com/excel-programming/431687-placing-calculation-based-two-sum-fields-loop.html)

S Himmelrich

placing calculation based on two sum fields in loop
 
I've got the following code below working where it provides sum of
dataset. What I now need to do is divide numerator/denominator as a
calculation in cell 10...how to do?

With ActiveSheet
lfR = 1
For lcR = 1 To .Cells(.Rows.Count, "B").End(xlUp).Row + 1
If Len(Trim(.Cells(lcR, 1))) = 0 Then
.Cells(lcR, 1) = .Cells(lcR - 1, 2) '& "- Averages"
.Cells(lcR, 11).Formula = "=SUM(K" & lfR & ":K" & lcR - 1 & ")"
' divide this into
.Cells(lcR, 12).Formula = "=SUM(L" & lfR & ":L" & lcR - 1 & ")"
' THIS
' I would imaging the code would go here, but don't know the
correct syntax
lfR = lcR + 1
End If
Next
End With


All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com