+ Reply to Thread
Results 1 to 4 of 4

VBA/button updating pivot charts but want to return to original sheet

  1. #1
    Registered User
    Join Date
    04-20-2016
    Location
    Wisconsin, USA
    MS-Off Ver
    2010
    Posts
    5

    VBA/button updating pivot charts but want to return to original sheet

    I have a worksheet with 3 tabs. One where data is recorded, one with high level summary, and one with detailed summary. The 2nd and 3rd tab mention contain pivot tables.

    I added a button on the first tab / data tab, to update all pivot tables. (I'm a VBA rookie so I was proud of that.) BUT I'm annoyed that at the end of the macro, the active sheet is the third tab. I'd really like it to either remain on the first tab where the button was ('data' tab) or at least to flip through the other tabs while it updates and at the end flip back to the tab with the button ('data').

    Here's the code I have in the button.

    -------
    Sub Button5_Click()

    Sheets("High Level- Rolling Scores").Select
    ActiveSheet.PivotTables("DetailedPivot").RefreshTable
    Sheets("Detailed- date, course, trainer").Select
    ActiveSheet.PivotTables("SummaryPivot").RefreshTable

    End Sub
    -------

    Any advice before I pull my hair out? Or am I stuck just being annoyed every time I use the 'refresh' button I've made?

    TIA!

    Edited to add - I know I misnamed by Pivot tables and the summary is on the detailed and the detailed is on the high level... BUT I got it working so I didn't want to mess with it... again, VBA rookie!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA/button updating pivot charts but want to return to original sheet

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    04-20-2016
    Location
    Wisconsin, USA
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA/button updating pivot charts but want to return to original sheet

    Hello, Mehmetcik.. thank you for trying to help!

    I've added: Sheets(1).select to the bottom of my grouping so it now reads
    ------
    Sub Button5_Click()

    Sheets("High Level- Rolling Scores").Select
    ActiveSheet.PivotTables("DetailedPivot").RefreshTable
    Sheets("Detailed- date, course, trainer").Select
    ActiveSheet.PivotTables("SummaryPivot").RefreshTable
    Sheets(1).Select

    End Sub
    ---------
    but it still ends with me being on the third tab, named "Detailed- date, course, trainer". I also tried swapping out the 1 in the code you typed with the word 'data', which is the name of the 1st sheet, the sheet I'd like to land back on at the end of the button doing it's thing but the third tab is still the active tab when I hit the button.

    If you'd please be willing to throw another idea at me, I'd love to try it!!

  4. #4
    Registered User
    Join Date
    04-20-2016
    Location
    Wisconsin, USA
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA/button updating pivot charts but want to return to original sheet

    Bump!
    Still no answer yet...

+ 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. Return to original sheet after macro
    By ngs007 in forum Excel General
    Replies: 2
    Last Post: 08-14-2014, 11:35 AM
  2. Command Button to Show Hidden pivot charts
    By Chioma1975 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-06-2013, 08:56 PM
  3. Make pivot charts bitmap and replace original
    By thedon_1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-23-2013, 06:18 AM
  4. Programmatically Return a Pivot Table to its Original State
    By fredblogs in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-09-2010, 10:57 AM
  5. Vb Return to original sheet
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-09-2008, 07:47 AM
  6. Trouble turning off sheet updating and returning to original active cell
    By Giznawz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2005, 06:05 PM
  7. updating pivot charts with vba
    By Tim in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2005, 04:06 PM

Tags for this Thread

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