+ Reply to Thread
Results 1 to 2 of 2

Creating pivot items that do not exist in the data array

  1. #1
    Registered User
    Join Date
    04-27-2015
    Location
    London
    MS-Off Ver
    Office 2010
    Posts
    2

    Question Creating pivot items that do not exist in the data array

    Hello all,

    In VBA can a pivot table display a PivotItem that does not exist in the data array?


    To elaborate further:-

    I have a spreadsheet that processes some data, creates a pivot table, and then puts this into a glossy output. The data varies between uses.

    It is important that both the PivotItem rows and columns are ordered in my specified order. To do this I am using .PivotItems("x").position = 1, .PivotItems("y").position = 2 etc

    If the PivotItem does not exist in the data array I get a run time error (for obvious reasons). Now if i use <On Error Resume Next> the spreadsheet works fine, but my glossy output gets messed up because it is relying on columns in the pivot table that are not there. Alternatively I could crudely program the spreadsheet to insert dummy data to make sure there is always data there to enable the PivotItems to be created.

    However I thought there is probably a much more elegant way to deal with this. I have been looking through the library and cant see anything. Does anyone have any ideas?

    Many thanks

    Andy

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Creating pivot items that do not exist in the data array

    Can you not create a custom sort order?
    http://www.contextures.com/excel-piv...tml#sortcustom
    Cheers
    Andy
    www.andypope.info

+ 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. Replies: 0
    Last Post: 10-31-2013, 04:07 PM
  2. Replies: 0
    Last Post: 08-17-2012, 07:00 AM
  3. [SOLVED] Columns in a pivot table show data that don't exist
    By RagonichaFulva in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-15-2012, 05:24 AM
  4. [SOLVED] WHY OH WHY! ... creating a dynamic array of outlookmail items, then display them.
    By WhytheQ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-24-2006, 04:50 AM
  5. Replies: 4
    Last Post: 06-18-2006, 01:10 PM

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