+ Reply to Thread
Results 1 to 6 of 6

Macro to change options of multiple pivot tables at once

  1. #1
    Registered User
    Join Date
    10-14-2011
    Location
    Papenburg, Germany
    MS-Off Ver
    Excel 2007
    Posts
    12

    Macro to change options of multiple pivot tables at once

    Hey all, I need to untick the options "For empty cells show" and "Preserve cell formatting on update" for 70 pivot tables at once. The tables are all in the same sheet and the data source is the same.

    I am quite good with excel but a total noob when it comes to VBA.

    I'd be terribly thankful if someone could help me out with a macro to do this!

    Nick
    Last edited by nholtappels; 02-22-2012 at 12:03 PM.

  2. #2
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Macro to change options of multiple pivot tables at once

    I think this could work:

    Please Login or Register  to view this content.
    I hope it helps.

  3. #3
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Macro to change options of multiple pivot tables at once

    OH and also if it goes slow, considering the amount of tables at work, try wrapping the code with "Application.ScreenUpdating = False" and then "Application.ScreenUpdating = True", and also "Application.Calculation = xlCalculationManual" and then "Application.Calculation = xlCalculationAutomatic", as in:

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363

    Re: Macro to change options of multiple pivot tables at once

    To keep your format i would this
    In the "Pivot Table" drop down menu, "Table Options", select/check "Preserve Formatting". This should maintain your formatting changes when you refresh data.

    As to refresh your pivot and keep your formatting with a macro, i will get back to you shortly
    Denis

    Please always attach the sample workbook without sensitive information when asking for help

    To add a module
    Press Alt + F11 (this is the Visual Basic Environment)
    Insert Menu, select Module
    Past code there
    Close Visual Basic Environment (X)

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Macro to change options of multiple pivot tables at once

    Can you attach a sample of 1 or 2 pivots with some dummy data?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  6. #6
    Registered User
    Join Date
    10-14-2011
    Location
    Papenburg, Germany
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Macro to change options of multiple pivot tables at once

    Big thanks to all of you guys! Pichingualas macro was exactly what I was looking for. I have no further questions

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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