VBA Pivot Table without subtotals

SueKi

New Member
Joined
Feb 15, 2022
Messages
44
Office Version
  1. 365
Platform
  1. Windows
How do I add fields to a pivot table without it subtotaling every field? The language I'm using to add the fields is:

VBA Code:
'Insert Row Fields
With ActiveSheet.PivotTables("ByJobPivotTable").PivotFields("Date Scheduled")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("ByJobPivotTable").PivotFields("Wip Location Dept")
.Orientation = xlRowField
.Position = 2
End With
With ActiveSheet.PivotTables("ByJobPivotTable").PivotFields("Dept Description")
.Orientation = xlRowField
.Position = 2
End With
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
.Subtotals = Array(False, False, False, False) 'with number of false depending on the layout of your PVT.

Use the macro-recorder and switch the subtotal off and on again + check the recorded macro to know that number.
 
Upvote 0
Solution
.Subtotals = Array(False, False, False, False) 'with number of false depending on the layout of your PVT.

Use the macro-recorder and switch the subtotal off and on again + check the recorded macro to know that number.
When I use the recorder, it does that for every field (including the ones not used in the pivot table.) Do I need to do that as well?
 
Upvote 0
VBA and pivottables is a difficult marriage.
Most of the time, i use the macro-recorder as guideline.
Thus yes, copy the whole macro-line into yours and check if it works.

If it doesn't work and you can't solve it, give a link with the icon here above.
 
Upvote 0
VBA and pivottables is a difficult marriage.
Most of the time, i use the macro-recorder as guideline.
Thus yes, copy the whole macro-line into yours and check if it works.

If it doesn't work and you can't solve it, give a link with the icon here above.
I got it!!! I can't believe it, I'm so happy. THANK YOU!!!

Right now, we have someone that cleans a report everyday, then makes and formats 2 different pivots from it. You've just saved us a ton of time. Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,603
Members
449,038
Latest member
Arbind kumar

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