Is it possible to automate pivot table formatting plz?

Bled

New Member
Joined
Dec 31, 2020
Messages
5
Office Version
  1. 2010
Platform
  1. Windows
Hello,

I always always use the same pivot table formating, checking 3 things before using it:

- Repeat item labels

- Show in Tabular Format

- Hide Subtotals

I know 3 clicks doesn't sound time consuming, but when you are working with pivot tables all day it can be.

I tried recording macro , but the result macro take more time than when done manually.

Can this formatting be by default? or is there VBa macro to help with it?

Any help appreciated, thanks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Paste the macro that you recorded
I just found this macro, does a good job so far, maybe it can help someone:

Sub CleanPivot()

Dim pt As PivotTable
Dim pf As PivotField

On Error Resume Next
Set pt = ActiveCell.PivotTable
On Error GoTo 0

If Not pt Is Nothing Then

'sets the pivot table into classic format
With pt

.RowAxisLayout xlTabularRow
End With

For Each pf In pt.PivotFields
If pf.Orientation = xlRowField Then

'This option sets all subtotal options (Sum, Count, Avg etc) to false
'pf.Subtotals = Array(False, False, False, False, False, False, False, False, False, False, False, False)
pf.Subtotals(1) = True
pf.Subtotals(1) = False
pf.RepeatLabels = True
End If
Next pf
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,209
Members
448,874
Latest member
b1step2far

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