+ Reply to Thread
Results 1 to 83 of 83

How do I add last line of pivot table to this forumla?

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

    How do I add last line of pivot table to this forumla?

    Hi

    I have this forumla which is copying data from one sheet to another. The data I'm copying is total revenue for a pivot table but depending on the filters you select the length of the pivot table changes depending on what data it is showing. I want to replace Range("B73:B73") with the last line of pivot table.

    Please Login or Register  to view this content.
    The data in the pivot table ends in cell B72 on the Revenue Dashboard sheet but this needs to change depending on where the pivot table ends, depending on what data is showing.

    How do I copy just the last line of the pivot table?

    Thanks,

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    if you want to copy the last cell of a pivot table
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

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

    Re: How do I add last line of pivot table to this forumla?

    Thanks, what would my forumla look like with this included then?

    I can't work out where to insert it into mine. Could you show me with a quick copy and paste onto my original?

    Thanks,

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    it's not a formula-it's code :-)

    it replaces the copy part of your code-i.e. everything but selecting the dashboard sheet

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    Sorry! Like this?

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    almost
    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    Thanks a lot! One problem though, on the revenue dashboard sheet, I actually have 2 pivot tables and the code you've provided me with is displaying the total for the wrong one. The one I want is in columns A&B lines 1-73 with the grand total being on line 73. How can I select the total from this one?

    Thanks

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    replace the 1 in Sheets("Revenue Dashboard").Pivottables(1) with either the pivot table name or 2 ;-)

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    My Pivot Table is called 'PivotTable6' I've put a 6 in where you suggested but I get a 'runtime error 9' Subscript out of range - when I press play macro.... any thoughts?

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    if you use the name it replaces the number
    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    Thanks, I've changed it to the above but it's still giving this error: runtime error 9' Subscript out of range

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    then that is not the name of the pivot table-perhaps
    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    Got it now, thanks for your help so far. I want the data to be pasted in cell T63 in Overall Dashboard - what do I change in the code to achieve this?

  14. #14
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    That's brilliant! thanks. I need to attach this info to 'CommandButton1' which I have on my sheet. When I click the button I want the data to be activated. So every time I click on the button, the data appears. How can I code the button to do this? Currently, the only way to get the data to appear is to press the triangle (play button) in visual basic and I need a button on the sheet.

    Thanks

  16. #16
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    add a forms button to the sheet and then assign that macro to the button

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

    Re: How do I add last line of pivot table to this forumla?

    Cool, thanks, final question:

    I want the code to be pasted in cell T63 not down from A1 as it is. How can I achieve this? Please show me where to put T63 into the code below.

    Please Login or Register  to view this content.
    Thank you

  18. #18
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    that code only puts the value in t63

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

    Re: How do I add last line of pivot table to this forumla?

    Sorry this is the code:

    Please Login or Register  to view this content.
    I want the data to appear in cell T63 when I click on command button one and then in the bottom half I want to clear cells T63-T70 when I click command button 2

    How do I modify it to get the results I want?

    At the moment, the total is being pasted down line by line from A1 but I want this to be from T63 instead.

  20. #20
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    replace the commandbutton1 code with the code you just posted

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

    Re: How do I add last line of pivot table to this forumla?

    It dosent work... I get a runtime error

  22. #22
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    what error? (it really feels like we're going round in circles here)

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

    Re: How do I add last line of pivot table to this forumla?

    OK I'll explain from the start:

    This is the code I currently have:

    Please Login or Register  to view this content.
    What this does is copy the grand total from my Pivot Table 6 in Revenue Dashboard to Overall Dashboard. This is currently being pasted in cell A1 (maybe my default) but I want it in cell T63 instead.

    I've replaced the this code with what you suggested further up the thread but I get an error when I press play.

    I'm assuming that there should be an easy way to tell the code to paste the data in cell T63. I'd like to find out how... Could you please tell me or show me what the code should be.

    I can clarify further if you like, thanks for your help so far, I'm almost there!

  24. #24
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    what error and on which line?

    this line
    Please Login or Register  to view this content.
    puts the value in t63

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

    Re: How do I add last line of pivot table to this forumla?

    Thanks but could you show me where in my code in post 23 it goes. Everytime I add in the line

    Please Login or Register  to view this content.
    to what I already have, I get errors when I press play.

    I've tried replacing existing code in there and adding it to the bottom but it's not working...

  26. #26
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    you don't add it you replace this line
    Please Login or Register  to view this content.
    with the new one

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

    Re: How do I add last line of pivot table to this forumla?

    OK it's looking like this:

    Please Login or Register  to view this content.
    And when I press Play, I get a Run Time Error '9' Subscript out of range error...

    Any thoughts on how to solve it?

  28. #28
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    didn't we already cover this and decide the pivot table was called "Pivot Table 6" not "PivotTable6"?

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    This provides a runtime error '1004' Unable to get Pivot Tables property of the worksheet class.

    When I click debug the top line is highlighted yellow...

  30. #30
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    with the previous code (the "pivottable6" version) which line gave you the error? it may be that the worksheet name is not correct

    this would be a lot quicker if you could post a workbook ;-)

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

    Re: How do I add last line of pivot table to this forumla?

    bizarrely it has now started pasting in T63 but it is not adding lines beneath it as it was previously. I want to change the slicers which in turn change the data that is being copied. So I need the same 'data being added on lines beneath cell T63' feature. Also as things stand the slicers freeze after I press the button a few times. I can't share the workbook as it contains analytics about the company I'm working with which is private

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

    Re: How do I add last line of pivot table to this forumla?

    I feel I need to add this row
    Please Login or Register  to view this content.
    but where in the code does it go?

  33. #33
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    you said you wanted the result in T63 so that's what the code does!

    perhaps you want something like
    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    That code provides a Run Time Error '1004' Application defined error

    Any ideas why?

    Thanks

  35. #35
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    no-it works for me. is your sheet protected?

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

    Re: How do I add last line of pivot table to this forumla?

    No it's not... any ideas? We're almost there!

  37. #37
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    it works for me-don't know what to tell you

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    There appears to be a problem on the first line as when I press debug it comes up yellow... does this help?

  39. #39
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    what is the error?

    did we establish the actual name of the pivot table? (you seem to keep switching the code)

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    This is the code I have and feel I should use as it means that the data will be copied and pasted into cell T63 and one below that every time I press the button , so I can easily compare numbers drawn from the table. This code produces a 'Run Time Error '1004' Application defined error' when I press play and says theres a problem with the top line (in bold). The table is called Pivot Table 6 and this line is the same as I was using in post 23 when the code was working fine - apart from it posted the data into cell A1...

  41. #41
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    that line looks ok but the line below is wrong-it should read
    Please Login or Register  to view this content.
    not
    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    Still gives a 'runtime error 1004 application defined error'...
    Last edited by no.18shirt; 05-09-2013 at 06:27 AM.

  43. #43
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    that's still the wrong line

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

    Re: How do I add last line of pivot table to this forumla?

    Sorry edited it to what it actually is in Visual Basic at the moment. If that's not correct please show me how it should be. The code in post 42 is causing the runtime error.

  45. #45
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    looks ok to me. can't see how you'd get an error on the "with" line so let's break it up a bit
    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    Still same run time error with that....

  47. #47
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    which line?

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    It says it can't get the pivot table properties of the work class sheet

  49. #49
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    that suggests the pivot table name is not correct

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

    Re: How do I add last line of pivot table to this forumla?

    Ok I've written over the pivot table 6 line and it seems to be working now.

    But it's still pasting values in T63 and going over them.

    I want it to paste the first value in T63 then the next time you click T64 then the time after T65

    So data ends up like this when you click 3 times:

    404.9
    22.5
    335.5

    One under each other

    Any ideas?

  51. #51
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    yes-I goofed
    Please Login or Register  to view this content.
    oughta be
    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    Cracking, it's working! Very last question:

    Please Login or Register  to view this content.
    With the range here I want it to lear from R63 to T68 (essentially clear everything within this rectangle section) How would I modify the range to get it to clear down from R63 to R68 and T63 to T68?

    Thanks a lot for your help, I really appreciate it. You've helped me build a cool tool at work to make it really easy to analyse and compare data from app analytics

  53. #53
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    perhaps just
    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    Yeah that works! I've got all my tables set up for all pivot tables on my dashboard but after a few times of pressing my 'Compare' and 'Clear' buttons they stop revealing data and load blanks. What would be causing this? The code is fine as it was doing it before fine, but after a few times it stops. I've tried 'resetting' and pressing 'play' in VB but that's not having an effect... any ideas. I'll post the code if you like but I don't think it's that as there are no errors.

  55. #55
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    what do you mean by "load blanks"?

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

    Re: How do I add last line of pivot table to this forumla?

    So I click the button and earlier it was loading the number that I wanted however now when I click you can see Excel 'load' and work out the function but no numbers appear and the cell is just left blank...

  57. #57
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    still not clear to me what you mean by
    you can see Excel 'load'
    how is it loading?

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

    Re: How do I add last line of pivot table to this forumla?

    Theres a brief delay while it works out what it's doing the 'loading' symbol comes up on the cursor. Basically I have some 30,000 lines which Excel is summarising into graphs, pivot tables and totals and it takes a brief while to calculate what it's doing. Its a minor point I think, the main problem is that it's not showing the data after a few clicks of the button. It works for the first few times then dosent and the code hasn't changed

  59. #59
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    the code we worked on doesn't do any of that so I don't think I can comment

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

    Re: How do I add last line of pivot table to this forumla?

    It does indirectly. Anyway, ignore the 'loading' side I was just trying to describe the problem.

    Why would a code stop working suddenly when nothing has changed? Any solutions to what I'm experiencing?

  61. #61
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    I can't think of any reason for it to stop working-it may be that it is doing what it was before but the copied cell is blank or the output is not where you expect or some other code is interfering

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

    Re: How do I add last line of pivot table to this forumla?

    This is all the code I have:

    Please Login or Register  to view this content.
    Does anything appear to be interfering with each other?

    This is code for a series of compare buttons for different sets of data and each one has a 'clear data' button. At the end I have a 'clear slicer' button at the end.

  63. #63
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    I'm confused as to why your code appears as
    Please Login or Register  to view this content.
    not
    Please Login or Register  to view this content.
    whenever you paste it here

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

    Re: How do I add last line of pivot table to this forumla?

    I've corrected it now above... it's because I'm copying it from my PC to my mac which I'm using to post on here. Everytime i put the code in an email it adds a smiley face instead of the x and i miss it so it ends up in here. If you see it, assume it's Max(.Cells

    Any ideas?

  65. #65
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    none really-the only code that changes any pivot tables is the last one and all that does is clear filters. I can't see how any of that code would cause the behavior that you describe

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    Should this row be the where I'm pasting to or where the data is being copied from?

  67. #67
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    the first part is the destination cell and the last part is the source

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    This is the code I'm currently using and it's pasting data in cell T195 not T63... any ideas why? I've deleted the rest to try to isolate the problem.

  69. #69
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    there must have been something in t195
    it oughta be
    Please Login or Register  to view this content.
    though

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    That's the full code, only command button 5 is doing what it should and pasting data into the right cells. The others above aren't... any ideas? I have no idea

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

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    That's the full code, only command button 5 is doing what it should and pasting data into the right cells. The others above aren't... any ideas? I have no idea

  72. #72
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    what are the others doing?

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

    Re: How do I add last line of pivot table to this forumla?

    I have 4 different sheets: overall dashboard, revenue dashboard, impressions dashboard and clicks dashboard

    Each of the Revenue, impressions and Clicks sheets contains a pivot table and pivot graph which are copied and put onto the overall dashboard to give a nice clean view of data.

    Command Button 1 is supposed to copy the grand total of the Pivot Table on revenue dashboard to cell T63 and paste downwards in 'overall dashboard'. It was doing this before as I said but has now stopped working.

    The same applies for 'Command Button 3'

    Only Command Button 5 is pasting data from impressions dashboard pivot table total into cell S197 and down in overall dashboard.

    I've copied the code from Command Button 5 and applied it to Command button 1 but it's still not working...

    Any ideas?

  74. #74
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    only if you answer my question-what are they doing? they must be doing something-based on your earlier post they are copying the data-just not where you expect it

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

    Re: How do I add last line of pivot table to this forumla?

    I have 4 different sheets: overall dashboard, revenue dashboard, impressions dashboard and clicks dashboard

    Each of the Revenue, impressions and Clicks sheets contains a pivot table and pivot graph which are copied and put onto the overall dashboard to give a nice clean view of data.

    Command Button 1 is supposed to copy the grand total of the Pivot Table on revenue dashboard to cell T63 and paste downwards in 'overall dashboard'. It was doing this before as I said but has now stopped working.

    The same applies for 'Command Button 3'

    Only Command Button 5 is pasting data from impressions dashboard pivot table total into cell S197 and down in overall dashboard.

    I've copied the code from Command Button 5 and applied it to Command button 1 but it's still not working...

    Any ideas?

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

    Re: How do I add last line of pivot table to this forumla?

    OK I think I've managed to figure it out myself. One more quick question:

    Is there anyway to adapt this code:

    Please Login or Register  to view this content.
    To clear contents in Active X text boxes as well as normal cells? The text boxes lie in the Q column and I want them to be cleared as well, whenever I press 'clear' (command Button 2)

    Thanks

  77. #77
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.
    will clear activex textboxes whose top left corner is in column q

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

    Re: How do I add last line of pivot table to this forumla?

    That's fantastic! I've combined the previous code with that one there to clear all textboxes and normal columns.

    One more thing actually,

    Please Login or Register  to view this content.
    Is there a way to get this to stop after line 70? So it will copy for 7 clicks only before you have to use the 'clear' function to do it again? My concern is that someone could just keep pressing my Command Button 1 (compare button) to have data being pasted all the way doen the page.

    Thanks for your help, I really appreciate it!

  79. #79
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    Please Login or Register  to view this content.

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

    Re: How do I add last line of pivot table to this forumla?

    That worked thanks. I've established the problem I've been having too and it's come back again unfortunately. It only seems to want to post in each column once before giving up. So I've ran the code above in column P and it worked fine once but when I try to do it a second time, it refuses to load anything and instead the 'please press clear then run this code again message pops up' without the numbers first.

    I have moved the pasting destination around columns and it does it once before not working anymore. How can I get it to keep pasting on demand in the same column?

    Thanks

  81. #81
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    it sounds to me like you have data somewhere below the output cells so lrow is larger than you think-I can't say why that would be without the workbook

    you could test by adding
    Please Login or Register  to view this content.
    to the code to see what the next row would be

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

    Re: How do I add last line of pivot table to this forumla?

    I've added that to the end of the code in VB as it is above but I'm getting a Compile Error. I'm assuming theres more to do than just sticking it at the end of the code, I am a beginner.

    I think you're right as code is being pasted way down in cell P136 when I click the button Command Button 1 in post 79... Do you know how to fix this? Again I've deleted the rest of the code so I'm just working with what's in post 79 but I cant see where it's getting the instruction to post in cell P136 from...

  83. #83
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How do I add last line of pivot table to this forumla?

    if it's posting in p136 then it thinks there is something in p135

    Please Login or Register  to view this content.

+ 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