+ Reply to Thread
Results 1 to 4 of 4

Pivot Table Permanent Formats

Hybrid View

BoothHopkins Pivot Table Permanent Formats 09-09-2013, 03:08 PM
JosephP Re: Pivot Table Permanent... 09-09-2013, 04:52 PM
BoothHopkins Re: Pivot Table Permanent... 09-09-2013, 04:54 PM
JosephP Re: Pivot Table Permanent... 09-09-2013, 05:03 PM
  1. #1
    Registered User
    Join Date
    09-09-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    2

    Pivot Table Permanent Formats

    Hi,

    I have a pivot table I am using for a report. I would like to format several variables differently (ie spend would be in accounting format, sales as general, etc). I know you can change the format by right clicking on the variable, but I would like a more permanent solution so that if I remove the variable from the "Values" list, it will still have the designated format when I bring it back in.

    Thanks!

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Pivot Table Permanent Formats

    the formats are not saved with the fields. you can use code if you have specific formats for specific fields
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    09-09-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Pivot Table Permanent Formats

    Yes, I need specific formats for each variables. How would I code this?

    Thanks!

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Pivot Table Permanent Formats

    for instance
    Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
        Dim pf As PivotField
        Application.EnableEvents = False
        For Each pf In Target.DataFields
            Select Case LCase$(pf.SourceName)
                Case "value"
                    pf.NumberFormat = "#,##0.00"
                Case "id"
                    pf.NumberFormat = "General"
            End Select
        Next pf
        Application.EnableEvents = True
    End Sub
    this code must be placed in the worksheet module for the sheet containing the pivot table (right-click the tab and choose view code and then paste it in)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. using pivot table with two different date formats
    By Dave7554 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2010, 04:18 PM
  2. Permanent change of Field Settings in Pivot Table
    By Sue Sch in forum Excel General
    Replies: 1
    Last Post: 07-21-2006, 12:10 AM
  3. pivot table formats
    By rcrBMS in forum Excel General
    Replies: 0
    Last Post: 06-07-2006, 09:30 AM
  4. Dates Formats in Pivot Table Help
    By Louis Markowski in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-11-2006, 05:55 PM
  5. Pivot table formats
    By Darby in forum Excel General
    Replies: 2
    Last Post: 10-07-2005, 10:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1