PIVOT TABLE FORMATTING

deno95

New Member
Joined
Jul 19, 2007
Messages
4
Is there a way to remove a formatted column(s)(metric) from a pivot table, then add that column(s) back and retain the original formatting? I need the formatted values to hold, as well as the column name. Everytime I remove a column and add it back, the column name goes back to "sum of "columnname" and the values reformat as well. Please Help!!! Is there a way to make the formatting stick when removing and re-adding columns to a pivot?

Thanks in advance, deno95
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,014
AFAIK - no. Options:<ul>[*]Don't drag the column off, just hide it (may not be an option of you have row/column totals being impacted).[*]Use VBA to lessen the annoyance by automating the reformatting.[/list]HTH
 

deno95

New Member
Joined
Jul 19, 2007
Messages
4
I don't actuall drag it off. I use the "data" drop-down and uncheck it. I then have to drag it back on if I want to add it back, and that is when i loose the formatting. Is there some general VBA code that will help automate re-formatting when adding columns backt to the pivot.

deno95
 

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,014
If'n the field is a data field, uncheckin' 'n' draggin' 's the same thing from a functional POV. As ta addin' 'er back in and then fiddlin' w/ some formattin'... dat ain't too terribly difficult...:wink:
Code:
Sub addfield()
    Dim pf As PivotField
        
    With ActiveSheet.PivotTables(1)
        Set pf = .AddDataField(.PivotFields("Shipments"), "Rumplestilskin", xlSum)
    End With
    With pf
        .NumberFormat = "#,##0"
        With .DataRange
            .Font.Color = vbBlue
            .Font.Bold = True
        End With
    End With
        
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,689
Messages
5,597,550
Members
414,155
Latest member
Grainne whiteside

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
Top