View Full Version : Subtotal Error
mzsuga
06-26-2009, 08:06 AM
I have this, then I run the macro but I get an error. Its to subtotal by column A then total only specific columns in that subtotal.
With Worksheets("Summaries")
Dim Subrg As Variant
subrg = Range("A1").CurrentRegion
Range(subrg).Subtotal Groupby:=1, Function:=xlSum, totallist:=Array(2,3,5,6,15,21)
End With
Bob Phillips
06-26-2009, 08:08 AM
Maybe this will help
With Worksheets("Summaries")
Dim Subrg As Variant
subrg = .Range("A1").CurrentRegion
.Range(subrg).Subtotal Groupby:=1, Function:=xlSum, totallist:=Array(2,3,5,6,15,21)
End With
mzsuga
06-26-2009, 08:23 AM
Maybe this will help
With Worksheets("Summaries")
Dim Subrg As Variant
subrg = .Range("A1").CurrentRegion
.Range(subrg).Subtotal Groupby:=1, Function:=xlSum, totallist:=Array(2,3,5,6,15,21)
End With
I tried that but it still gives me an error.
Bob Phillips
06-26-2009, 09:38 AM
If this doesn't work, does your region have 21 columns?
With Worksheets("Summaries")
Dim Subrg As Range
Set Subrg = .Range("A1").CurrentRegion
.Range(Subrg).Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(2, 3, 5, 6, 15, 21)
End With
mzsuga
06-26-2009, 09:39 AM
If this doesn't work, does your region have 21 columns?
With Worksheets("Summaries")
Dim Subrg As Range
Set Subrg = .Range("A1").CurrentRegion
.Range(Subrg).Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(2, 3, 5, 6, 15, 21)
End With
Yes it has 21 columns, but the column headings start at row5
Aussiebear
06-26-2009, 04:02 PM
Try changing the line to reflect the starting point for the currrent region;
Set Subrg = .Range("A5").CurrentRegion
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.