+ Reply to Thread
Results 1 to 3 of 3

Dynamically use sheet names for pivot tables.

  1. #1
    Forum Contributor
    Join Date
    03-14-2013
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    123

    Dynamically use sheet names for pivot tables.

    Hello,

    I'm currently working on a macro that will loop through my sheets and create pivot tables for each sheet. I have the pivot macros down now I'm having trouble getting it to work across all sheets dynamically. The below code works for one sheet that I pre-defined.
    How would I create the Pivot table so that it would be dynamic. I want the macro to create the source data based off the worksheet that it's pulling from. Also i want the destination sheet to be named the same as the source sheet, except to add pivot at the end. so sheet 1 would also have sheet 1 pivot that would contain the pivot table.
    Basically how do I write the code so that the yellow sections are set to be dynamic and based off the sheet that it is creating the pivot table from?

    If i have a loop
    Please Login or Register  to view this content.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Dynamically use sheet names for pivot tables.

    Since I don't have a workbook this is "air code." Assuming the rest of your code works, this should work. Also the code as you have it will try to create multiple PivotTable1. This might cause a problem. I took care of that with a counter. You may want to name the pivot table something more descriptive.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    03-14-2013
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: Dynamically use sheet names for pivot tables.

    I found through Googling the below code and it works! Thanks for your help regardless.
    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)

Similar Threads

  1. [SOLVED] Dynamically changing several pivot tables at once
    By Jason in forum Excel General
    Replies: 4
    Last Post: 10-18-2021, 05:59 PM
  2. Field names in Pivot Tables
    By ellenhotz in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-13-2013, 09:54 PM
  3. Replies: 3
    Last Post: 04-17-2011, 03:23 AM
  4. Updating Pivot Tables Dynamically
    By JagR in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-11-2010, 04:56 AM
  5. Dynamically changing print areas for Pivot Tables
    By Todd1 in forum Excel General
    Replies: 1
    Last Post: 08-16-2006, 10:00 PM
  6. range names in pivot tables
    By Forrest in forum Excel General
    Replies: 0
    Last Post: 01-10-2006, 02:45 PM
  7. Names into Pivot Tables
    By fishy8000 in forum Excel General
    Replies: 0
    Last Post: 03-24-2005, 03:30 PM
  8. Pivot Tables and Names
    By fishy8000 in forum Excel General
    Replies: 0
    Last Post: 03-24-2005, 03:09 PM

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