Sorry, having a brain fade there. Try this:
Public Sub InstallSubtotals()
Dim ws As Worksheet
Dim rngCell As Range
Dim lngRef As Long
With Application
.DisplayAlerts = False
lngRef = .ReferenceStyle
.ReferenceStyle = xlR1C1
End With
Range("A3").Select
For Each ws In ActiveWorkbook.Worksheets
If IsNumeric(ws.Name) Then
With ws
.UsedRange.RemoveSubtotal
With .Range(.Cells(2, "C"), .Cells(.Rows.Count, "C").End(xlUp).Offset(, 24))
.Subtotal GroupBy:=2, Function:=xlSum, _
TotalList:=Array(7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
End With
.Outline.ShowLevels RowLevels:=2
On Error Resume Next
With .Cells(.Rows.Count, "D").End(xlUp).Resize(, 24)
.SpecialCells(xlCellTypeBlanks).EntireColumn.Hidden = True
.SpecialCells(xlCellTypeVisible).Borders(xlEdgeTop).Weight = xlThin
End With
On Error GoTo 0
With .Range(.Cells(4, "D"), .Cells(.Rows.Count, "D").End(xlUp).Offset(, 23)).SpecialCells(xlCellTypeVisible)
.Font.Bold = True
.Borders(xlEdgeTop).Weight = xlThin
End With
.Columns("D:AA").Hidden = False
.Range("D:T").SpecialCells(xlCellTypeFormulas).Replace "9,*:", "9,R4C:", xlPart
End With
End If
Next ws
With Application
.DisplayAlerts = True
.ReferenceStyle = lngRef
End With
End Sub
Bookmarks