Thread: Subtotal
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Subtotal

Sub test()
Dim iLastRow As Long
Dim tmp
Dim i As Long
With ActiveSheet
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow + 1
If .Cells(i, "A").Value < "" Then
tmp = tmp + .Cells(i, "A").Value
Else
.Cells(i, "A").Value = tmp
tmp = 0
End If
Next i
End With

End Sub


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Mat" wrote in message
...
Dear Mate,

I have data in colum A which has revenue on each row and a blank row after
every regular intervals but the row count is different in each row . I
need
to put subtotal formuls in each blank row. For eg.

Col A
399.2
38.5
5.0
0.2
Subtotal (A1-A4)
0.3
Subtotal (A5)
0.3
Subtotal (A6)
9.2
2.2
0.8
0.3
0.1
0.1
0.1
Subtotal (A7-13)
5.2
0.5
Subtotal (A14-15)

Regards

mat