placing calculation based on two sum fields in loop

S

S Himmelrich

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top