Formatting Pivot Tables on Multiple Worksheets

SAMCRO2014

Board Regular
Joined
Sep 3, 2015
Messages
160
I have 17 worksheets (by manager) with one pivot table per worksheet filtered to data to suit each manager's needs. All the headings are the same on each pivot table. There must be a way to format all the pivot tables the same way at the same time or via a loop but I can't figure it out. I tried recording it and got a whole bunch of coding which is making my macro too long and it will not run.

Any ideas? I was thinking along the lines:

For each PivotTable on the Worksheet
PivotTable. Activate
Insert format coding here
Next Worksheet

Can this be done?
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Re: Formatting Pivot Tables on Mutiple Worksheets

Hi there, you can try doing something like this:

Code:
For Each ws In ActiveWorkbook.Worksheets
    For Each pt In ws.PivotTables
        'Insert format code here
    Next pt
Next ws


If each value field should be the same format, you can add in
Code:
For Each df In pt.DataFields
 
Upvote 0
Re: Formatting Pivot Tables on Mutiple Worksheets

So which sheet has the Pivot table style you want copied to all other sheets
Would it be Sheet(1)
So you want sheets 2 to the last sheet in your workbook to have the same Pivot Table format as Pivot table on Sheets(1)
Is that true?

Then use this script:

Code:
Sub Format_Pivot_Table()
'Modified  10/19/2018  10:07:30 AM  EDT
Application.ScreenUpdating = False
Dim ans As String
Dim i As Long
ans = Sheets(1).PivotTables(1).TableStyle2
    For i = 2 To Sheets.Count
        Sheets(i).PivotTables(1).TableStyle2 = ans
    Next
Application.ScreenUpdating = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,906
Messages
6,181,665
Members
453,059
Latest member
jkevin

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