+ Reply to Thread
Results 1 to 14 of 14

change current pie chart by clicking on one part of the pie.

  1. #1
    Registered User
    Join Date
    07-17-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    change current pie chart by clicking on one part of the pie.

    Hello,

    I would like to know whether it is possible to change the current pie chart into another one, by clicking on one piece of the pie. In the attachment I added an example.

    I want the total sales (from the continents) in one pie chart. Then, if I click on one part of the pie (for example Europe) I want that the pie chart changes in to a pie chart of Europe.

    Is there a VBA code or other solution to accomplish this?

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Forum Contributor vikas.bhandari's Avatar
    Join Date
    04-07-2006
    Location
    Delhi, India
    MS-Off Ver
    Office 2007 and 2010
    Posts
    303

    Re: change current pie chart by clicking on one part of the pie.

    I have created a sample to just give you an idea of how we can do it.

    Instead of changing the current chart, I preferred and it is easy to change the chart next to it. So I have now two charts. The new chart has the source data which is dynamic and gets changed as per the input specified in the red cell.

    Now if you double click on any series in the Sales Pie chart, for example, you click Asia, the chart on the right will populate the Asia Data. Also, please remember that it is not a final solution but just a trick which you can use to proceed.

    Thanks,
    Vikas B
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-17-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: change current pie chart by clicking on one part of the pie.

    Thanks, I think this solution works quite well.

    However, I prefer to work with one graph but I am not sure whether it is possible...

  4. #4
    Forum Contributor vikas.bhandari's Avatar
    Join Date
    04-07-2006
    Location
    Delhi, India
    MS-Off Ver
    Office 2007 and 2010
    Posts
    303

    Re: change current pie chart by clicking on one part of the pie.

    It is possible, but the amount of code you will need to put in will be too much. I don't think it is worth putting so much of efforts.

    There can be one more trick although, when you double click the sales chart, you can hide it and show the region chart, and when you double click on Region chart, show the sales chart. It will look like there is a single chart.

    Thanks,
    Vikas B
    Attached Files Attached Files
    Last edited by vikas.bhandari; 07-18-2012 at 04:50 AM. Reason: Added Sample

  5. #5
    Registered User
    Join Date
    07-17-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: change current pie chart by clicking on one part of the pie.

    Oke, I see. Well, I know the basics of VBA but I don't how to write a code with the hiding and showing of both graphs. Could you help me with this?

    Thanks!

  6. #6
    Forum Contributor vikas.bhandari's Avatar
    Join Date
    04-07-2006
    Location
    Delhi, India
    MS-Off Ver
    Office 2007 and 2010
    Posts
    303

    Re: change current pie chart by clicking on one part of the pie.

    Added the sample in the previous post.

    Thanks!
    Vikas

  7. #7
    Registered User
    Join Date
    07-17-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: change current pie chart by clicking on one part of the pie.

    the file gives an error when I open it.

  8. #8
    Registered User
    Join Date
    07-17-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: change current pie chart by clicking on one part of the pie.

    It already works!

    Thanks!

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

    Re: change current pie chart by clicking on one part of the pie.

    This approach avoids the use of macros. Down side is you use form controls to select pie content rather than event code to capture chart clicks.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  10. #10
    Registered User
    Join Date
    07-17-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: change current pie chart by clicking on one part of the pie.

    Thanks Andy! I will try to figure it out!

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

    Re: change current pie chart by clicking on one part of the pie.

    It uses a whole bunch of named ranges. Check Formula > Name Manager. to see them

  12. #12
    Registered User
    Join Date
    07-17-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: change current pie chart by clicking on one part of the pie.

    Oke, I will try it first and if there are still some questions I will let you know.

    Thanks

    ---------- Post added at 04:48 PM ---------- Previous post was at 03:46 PM ----------

    Hi Andy,

    My file is already working properly, however the title of the graph doesn't change. It stays the same. What am I doing wrong?

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

    Re: change current pie chart by clicking on one part of the pie.

    Hard to say as you don't tell us what you did do.

    Guess would be you have not linked the chart title to the cell.
    http://www.andypope.info/tips/tip001.htm

  14. #14
    Registered User
    Join Date
    07-17-2012
    Location
    Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: change current pie chart by clicking on one part of the pie.

    I already solved it. 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