+ Reply to Thread
Results 1 to 4 of 4

VBA IF statement tied to expand/collapse pivot items

  1. #1
    Registered User
    Join Date
    10-17-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    71

    Question VBA IF statement tied to expand/collapse pivot items

    Hi! I have some graphs below a pivot table and wanted the graphs to move down when I choose to expand one of my pivot items. Instead of moving, the graphs stay locked over my data (once it has expanded). To remedy the issue, I tried to work with the following code, but I can't seem to make this work:

    When a pivot item expands, I want the code to cut the graphs and paste them to another sheet. When a pivot item collapses, I want the code to do the reverse. This way, I won't see my graphs when I expand the pivot items and I will see the graphs when I collapse the pivot items.

    Please Login or Register  to view this content.
    If there is a better way to do this, please let me know. I'm not sure why the graphs don't just move with the cells when the pivot items are expanded/collapsed.

    Thanks for your help!

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA IF statement tied to expand/collapse pivot items

    Just use
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    instead of copying and pasting to a different sheet to hide them.

    Change sheet and chart names as appropriate

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA IF statement tied to expand/collapse pivot items

    Why not move the charts to the left of the pivot tables?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    10-17-2012
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    71

    Re: VBA IF statement tied to expand/collapse pivot items

    I like the idea of making the chart objects visible and invisible like yudlugar suggested. I need help coding a macro that would hide/unhide the charts if a pivot item is expanded or collapsed. When expanded, hide the charts; when collapsed, show the charts. If anyone can get me some basic code on that, I could probably tweak it to work.

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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