jski
Board Regular
- Joined
- Jan 11, 2006
- Messages
- 118
Good morning, good afternoon and good evening to all,
I can't seem to get this to insert a subtotal after each break I've created in my extract. It only installs a total after the first instance and not the others. Also, it only works in column H but I need it to install a total in column I as well.
I have about five breaks currently but it could vary depending on the pulled data. Thanks in advance for your generous consideration.
jski
I can't seem to get this to insert a subtotal after each break I've created in my extract. It only installs a total after the first instance and not the others. Also, it only works in column H but I need it to install a total in column I as well.
Code:
' Add Subtotals
Dim ThisCell As Range
Dim MySum As Double
Set ThisCell = Range("H2")
nxt:
Do While ThisCell <> ""
MySum = MySum + ThisCell
Set ThisCell = ThisCell.Offset(1, 0)
Loop
ThisCell.Value = MySum
If ThisCell.Offset(1, 0) <> "" Then
Set ThisCell = ThisCell.Offset(1, 0)
MySum = 0
GoTo nxt
End If
I have about five breaks currently but it could vary depending on the pulled data. Thanks in advance for your generous consideration.
jski