VBA for Pivot Table Subtotal Location

mauricio1013

New Member
Joined
Apr 24, 2012
Messages
2
I have tried about a million different ways to write the code to have my macro automatically set the pivot table subtotals to the bottom. It seems like it would be easy, but it isn't!

Here is what i get when i record the macro:

Sub SubTotalLocation_Bottom()
'
' SubTotalLocation_Bottom Macro
'
Sheets("Strike Report").Select
Range("A3").Select
ActiveSheet.PivotTables("MyPT").SubtotalLocation = xlAtBottom

End Sub

When I run that sub i get the following error message:

Run-time error '438':
Object doesn't support this property or method

Anyone have a clue? This is driving me nuts?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi and Welcome to the Board,

Your syntax is just slightly off.
Change: .SubtotalLocation = xlAtBottom

To: .SubtotalLocation(xlAtBottom)

You can also streamline it a bit by removing the .Select and
directly referencing the objects....
Code:
Sheets("Strike Report").PivotTables("MyPT").SubtotalLocation (xlAtBottom)
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,320
Members
449,218
Latest member
Excel Master

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