Problem with Bob Umlas sub total code. Coming up with user define
Hi Gai
This should do what you need. It takes a slightly different view,
looks at the last used cell in Col A (making the assumption that
descriptive data is in this Column. It then moved backwards from the
bottom of Column S & T checking for empty cells . It sums downwards
not to the next entry in either column S or T but to the last sum (as
such it gathers all the figures inbetween the two sum ranges and
therefore all the figures in either S or T. Oh and of course it makes
the sum range bold. Let the group know how you get on.
Take Care
Marcus
Option Explicit
Sub SubtotalBlanks()
Dim RowCnt As Integer
Dim ColCount As Integer
Dim start As Integer
Dim i As Integer
RowCnt = Range("A" & Rows.Count).End(xlUp).Row
start = RowCnt
'Do Until RowCnt = 25
For i = RowCnt To 2 Step -1
If Range("S" & RowCnt).Value = "" And Range("T" & (RowCnt)).Value =
"" Then
For ColCount = 19 To 20 'The Sum Bit
Cells(RowCnt, ColCount).FormulaR1C1 = _
"=SUM(R" & start & "C:R" & RowCnt + 1 & "C)"
Cells(RowCnt, ColCount).Font.Bold = True 'The Bold Bit
Next ColCount
start = RowCnt - 1
Else
RowCnt = i - 1
End If
RowCnt = i
Next i
End Sub
|