Nested Subtotal adding two Grand Totals

ExcelNoob222

Board Regular
Joined
Jun 17, 2020
Messages
77
Office Version
  1. 365
Platform
  1. Windows
Hi,

When I do this manually using the subtotal menu under data I get only one grand total. However when I use the below VBA it adds two grand totals:

VBA Code:
Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(8, 11), _
        Replace:=False, PageBreaks:=False, SummaryBelowData:=True
    Selection.Subtotal GroupBy:=5, Function:=xlSum, TotalList:=Array(8, 11), _
        Replace:=False, PageBreaks:=False, SummaryBelowData:=True
    Range("A1").Select

Any suggestions? Thanks.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
In case anyone else runs into this issue in the future, I was able to figure out this work around:

VBA Code:
On Error Resume Next
   Cells(Columns(5).Find(What:="*Grand Total*", LookIn:=xlValues).Row, 1).EntireRow.Delete
 
Upvote 0
Solution

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top