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
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,496
Messages
6,113,993
Members
448,539
Latest member
alex78

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