+ Reply to Thread
Results 1 to 18 of 18

Creating a mini table to summarise a pivot chart

  1. #1
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Creating a mini table to summarise a pivot chart

    Hi

    I have a pivot chart which is really good at visually looking at data ie the shape and trend of data over time. But I'd like to add some numbers to make it more informative.

    As it stands I have 6 boxes of various filters, one chart and a 'total number' which provides the total revenue for which ever filters you have selected.

    What I'd like to do is create a button where you can click 'comapre' and if you were looking at the data for January the revenue total will then be transfereed into a box/table/list next to the button where you could then add February and march data to it to compare the numbers as well as the visual representation that the graph gives.

    EG

    View Jan data on graph then you can click a button which then saves the grand total which I have already into a separate Box/Table

    I then change the graph to view the data for Feb, click the button and the grand total is saved into this new table to compare it to January.

    What would the code be for this?

    I'm expecting it to be simple as all I'm doing is copying the code from one place to another and saving it. However keep in mind that the total revenue number is always going to be changing depending on the graph you're viewing.

    Any ideas how? So I'm looking for the code to programme the button to copy, paste and save the total revenue data into a new mini table to compare previous scores.

    Thanks

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Creating a mini table to summarise a pivot chart

    Hi no.18shirt,

    Why you want data from chart, why not pick data directly from the chart's source data ?
    Also, can you share the sample workbook ? Thanks.

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Creating a mini table to summarise a pivot chart

    Hi,

    Thanks for the reply.

    I've attached a sample as I can't use the official version as the data belongs to the company I'm working with.

    What I want is to click the 'button 2' that copys the data from 'Grand Total'(B14) into the comparison box below. I then want to change the filter in B1, be shown a different grand total so I can click the button to save that into the comparison table so I can compare the two sets of Grand Totals.

    Ideally the button would also copy the filter name and paste that with the Grand Total result. In the full version I have lots of slicers so if you could show me how I can copy the name of the slicers along with the corresponding Grand Total result, that would be great!

    Many thanks,
    Attached Files Attached Files

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Creating a mini table to summarise a pivot chart

    Okay.. See attached workbook where I have used below code to achieve the desired results:-
    Samplecompare.xlsm

    Please Login or Register  to view this content.

    Regards,
    DILIPandey
    <click on below * if this helps>

  5. #5
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Creating a mini table to summarise a pivot chart

    Thanks thats great, exactly what I want!

    On my version, I've clicked 'Sheet 1' in Visual basic, written on a new blank code sheet under (declarations)

    Please Login or Register  to view this content.
    It's saying I have a 'Compile Error' in AH61 where on my sheet is the value I'm trying to copy. As of now I'm just trying to copy one value, I'll do the filter value later so I can get my head around this.

    The value I have on my Sheet 1 AH61 is a copy of the value from a Pivot Table in another sheet. Do I need to be referencing this or can I still use the copied value?

    I'm trying to have AH61 copied to AH76.

    Please can you let me know what to do. Many thanks

  6. #6
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Creating a mini table to summarise a pivot chart

    Is what I'm aiming to do possible?

  7. #7
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Creating a mini table to summarise a pivot chart

    not sure about your data arrangement ... did it matches with the sample your provided above ? If yes, then it should be working else upload/ revise sample. thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

  8. #8
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Creating a mini table to summarise a pivot chart

    Here's a sample workbook. Instructions are attached. As the data is private, I've had to modify it and hide app names. It would be really useful if you could lay out the steps I need to take to achieve my goal so I can apply it to my real workbook. Many thanks.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Creating a mini table to summarise a pivot chart

    Any ideas?

  10. #10
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Creating a mini table to summarise a pivot chart

    Okay.. see the attached file where replicated my previous code :-

    Sample Book Comparison Box.xlsm


    Regards,
    DILIPandey
    <click on below * if this helps>

  11. #11
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Creating a mini table to summarise a pivot chart

    Thanks.

    Please Login or Register  to view this content.
    I understand this part as that's where the info is being taken from.

    But I'm confused by this part:

    Please Login or Register  to view this content.
    Please explain what this part means and why it ends up 'pasting' the data where it does, in this case in the workbook, cells E&F28 downwards. I'm looking to understand the thinking behind the code so I can adapt it myself.

    Many thanks,

  12. #12
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Creating a mini table to summarise a pivot chart

    okay.. so this code is triggering the cursor to go up from the last row of row A.. and when the cursor touches any data it offsets itself one cell down and writes the value of i there.



    Regards,
    DILIPandey
    <click on below * if this helps>

  13. #13
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Creating a mini table to summarise a pivot chart

    Thanks, would you be able to tell me how I can code the above to work whenever the command button is clicked?

    I've edited the code on my one and need to now code the button to run the code every time it's clicked.

    Thanks

  14. #14
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Creating a mini table to summarise a pivot chart

    Okay.. Insert the activeX command button in sheet.
    right click on it -> view code
    and paste your code in between below lines which you'll see there:-
    Please Login or Register  to view this content.

    Regards,
    DILIPandey
    <click on below * if this helps>

  15. #15
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Creating a mini table to summarise a pivot chart

    Thanks, I've got this and it's working now!

    How do I make a 'clear box' to clear the data at the click of a button?

  16. #16
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Creating a mini table to summarise a pivot chart

    To clear the data you can use the code line Range("a1:a4").Clear where you need to replace the range a1:a4 with your range which need to be cleared. thanks.



    Regards,
    DILIPandey
    <click on below * if this helps>

  17. #17
    Forum Contributor
    Join Date
    06-19-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Creating a mini table to summarise a pivot chart

    Please Login or Register  to view this content.
    This is my code and I'm getting a 'Run Time error 1004' Application Defined or object defined error.... Any ideas why?

  18. #18
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Creating a mini table to summarise a pivot chart

    Okay.. upload the workbook containing this code so that I can run and debug / correct it easily


    Regards,
    DILIPandey
    <click on below * if this helps>

+ 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