SAMCRO2014
Board Regular
- Joined
- Sep 3, 2015
- Messages
- 160
I have search the forum and found coding on how to delete subtotal groups that equal 0 and have tried a few with no success. I must be missing something.
My subtotals are added for each change in column F and it is subtotalling amounts in Column M. I haveover 460K lines of data.I started deleted them manually but it will take forever.
DelZeroBlocks()
Dim c As Range
Dim cf As String
For Each c In Range("M2", Range("M" & Rows.Count).End(xlUp) _
.Offset(-1)).SpecialCells(xlCellTypeFormulas)
If c.Value = 0 Then
cf = c.Formula
Union(c, Range(Replace(Mid(cf, 13, Len(cf)), ")", ""))).EntireRow.Delete
End If
Next c
End Sub
My subtotals are added for each change in column F and it is subtotalling amounts in Column M. I haveover 460K lines of data.I started deleted them manually but it will take forever.
DelZeroBlocks()
Dim c As Range
Dim cf As String
For Each c In Range("M2", Range("M" & Rows.Count).End(xlUp) _
.Offset(-1)).SpecialCells(xlCellTypeFormulas)
If c.Value = 0 Then
cf = c.Formula
Union(c, Range(Replace(Mid(cf, 13, Len(cf)), ")", ""))).EntireRow.Delete
End If
Next c
End Sub
Last edited: