jaslake
New member
- Joined
- Aug 2, 2011
- Messages
- 81
- Reaction score
- 0
- Points
- 0
- Location
- mineral city oh usa
- Excel Version(s)
- 2007;2010;MAc2011
Hi Jonathan
The Code in the attached has been modified to add Subtotals to Columns H and J of the Target Worksheets.
I can't for the life of me understand why you made this change in the Code...I believe you should change it back. You are filtering on Line 14, the Header Row is Line 9.
The Code in the attached has been modified to add Subtotals to Columns H and J of the Target Worksheets.
Code:
.Columns("H:H").Select
On Error Resume Next
LastRow = .Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, _
LookIn:=xlFormulas).Row
For Each Area In ActiveCell.EntireColumn(1).Resize(LastRow). _
SpecialCells(xlCellTypeConstants).Areas
Area.Offset(0, 0).Select
With Selection.Areas(Selection.Areas.Count)
x = .Cells(1).Offset(0, 0).Address
y = .Cells(.Cells.Count).Address
z = .Cells(.Cells.Count).Offset(1, 0).Address
Range(z).Formula = "=sum(" & x & ":" & y & ")"
Range(z).Font.FontStyle = "Bold"
End With
Next
On Error GoTo 0
.Columns("J:J").Select
On Error Resume Next
LastRow = .Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, _
LookIn:=xlFormulas).Row
For Each Area In ActiveCell.EntireColumn(1).Resize(LastRow). _
SpecialCells(xlCellTypeConstants).Areas
Area.Offset(0, 0).Select
With Selection.Areas(Selection.Areas.Count)
x = .Cells(1).Offset(0, 0).Address
y = .Cells(.Cells.Count).Address
z = .Cells(.Cells.Count).Offset(1, 0).Address
Range(z).Formula = "=sum(" & x & ":" & y & ")"
Range(z).Font.FontStyle = "Bold"
End With
Next
On Error GoTo
Code:
If Not .AutoFilterMode Then
.Rows("14:14").AutoFilter
'.Rows("9:9").AutoFilter
End If
Attachments
Last edited: