+ Reply to Thread
Results 1 to 7 of 7

I need macro/vba help: Code to refresh pivot table!!

  1. #1
    Registered User
    Join Date
    06-20-2014
    Location
    west midlands
    MS-Off Ver
    2010
    Posts
    5

    I need macro/vba help: Code to refresh pivot table!!

    I'm relatively new to vba and require some help constructing a code .

    objective: i have a huge set of data 200k+ rows which is updated monthly, each time a new report is ran there is a template sheet where i drop the data and have to manually update three pivot tables linked to it that then do a find remove on one column to get rid of a set list of text. The second stage is to update and refresh the individual pivot tables and then copy this data into a summary.

    All I want to do is to be able to put all that into a code so each month i don't have to do the repetitive task of manually removing the same text and refreshing the table etc

    Anyone know how?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,373

    Re: I need macro/vba help: Code to refresh pivot table!!

    Suggest you switch on the macro recorder while you do the task(s) manually. That will give you the basic code. It will probably need tweaking and refining to make it generic and more efficient.

    At that point, come back with a sample workbook and the embryo code and someone will help you to make it do what you want ... with a little luck

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-20-2014
    Location
    west midlands
    MS-Off Ver
    2010
    Posts
    5

    Re: I need macro/vba help: Code to refresh pivot table!!

    a common sense move , thanks TMS

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,373

    Re: I need macro/vba help: Code to refresh pivot table!!

    You're welcome.

  5. #5
    Registered User
    Join Date
    06-20-2014
    Location
    west midlands
    MS-Off Ver
    2010
    Posts
    5

    Re: I need macro/vba help: Code to refresh pivot table!!

    Apologies if the below is asking too much as I am a novice to VBA and trying to catch up quickly.
    The below is the ‘embryo code’ generated from a recorded macro. Numerous attempts to edit this myself has caused various compile errors so I’m at my wits end.

    Please help!!
    The objective I want to achieve is to have a button that the user presses once they have entered data into columns l to V the data quantity is upwards of 300k rows each time so filters have been applied from columns A-K.

    Once data is entered I want the code to find and replace specific references in column k which removes part of the text. In this example _yes, _no, _maybe. It’s safe to assume these variables will always be at the end of the text. I then want to make sheet two which is the pivot table which will be hidden to appear and refresh .

    Then copy and paste special values all that data into a new sheet change ‘Key2’ values to be in a specific order and then copy and paste the data values and key amounts only (without headers) into a set template.
    The stages up to this point are quite repetitive hence the need for the coding
    There are various pivot tables that will need refreshing and data copied into different sheets relevant to each pivot table so any instructions you can add to the code to help me identify what i can modify would help.

    The user will then have instructions of how to manually manipulate the set template only.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: I need macro/vba help: Code to refresh pivot table!!

    Hi,

    Does the attached help. It uses the following procedures

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    I also added the dynamic range name "Data" to cover your data set and used that name in the PT. I also added a one line macro in the PT sheet Activate event that automatically refreshes the PT every time you select it. It's also refreshed when you use the first of the procedures above.
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  7. #7
    Registered User
    Join Date
    06-20-2014
    Location
    west midlands
    MS-Off Ver
    2010
    Posts
    5

    Re: I need macro/vba help: Code to refresh pivot table!!

    Thanks Richard Buttrey - this works perfectly

+ 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. [SOLVED] VB Code to Refresh Pivot Table Automatically every 5 mins - For Dashboard
    By MarkyP18 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-06-2015, 04:38 PM
  2. Problems with code to refresh pivot table
    By Masun in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-19-2015, 09:04 AM
  3. VBA code to auto refresh Pivot table
    By GEMINI528 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-29-2014, 07:01 PM
  4. Pivot table refresh - VBA Code
    By Raviprasad.k in forum Excel General
    Replies: 3
    Last Post: 12-14-2012, 08:19 AM
  5. Refresh Multipe Pivot Table Macro
    By DaFonz01 in forum Excel General
    Replies: 1
    Last Post: 03-18-2010, 03:56 AM
  6. pivot table refresh code failed
    By dreamz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2005, 03:22 PM
  7. Code to Refresh Pivot Table
    By S Jackson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2005, 01:05 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