Running Multiple Pivot Tables With Same Macro

Aug 31, 2006

I am trying to find a way to set up a macro that will allow me to pull in data - create the Pivot table - delete the table - then pull in fresh data (of a different row length - same number of columns) and create another Pivot table. I have tried to manipulate recorded code to no avail. Here is what I am starting with:

Const lngLastPossRow As Long = 65536
Range(Cells(1, 1), Cells(Cells(lngLastPossRow, 1).End(xlUp).Row, 24)).Name = "Data"

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:="Data"). _
CreatePivotTable TableDestination:="", TableName:="PivotTable2", _
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable2").AddFields RowFields:=Array(" ", _
"Channel", "Sales/Exchange", "Mode of transp.", "Sold-to Party", "Material", "Data")

While it creates the first pivot table fine, after deleting it and starting again it wants to create the next sequence (PivotTable3) which crashes the macro. I must close the file and reopen to run it again.

View 4 Replies


ADVERTISEMENT

EXCEL 2007 :: How To Make Percentage Of Running Total In Pivot Tables

Jan 15, 2014

how to make a % of running total in pivot tables in excel 2007. the running total in is only available not the "%".

View 1 Replies View Related

Adjust Column Label Selection Multiple Pivot Tables Based On One Pivot Table

Aug 16, 2013

I have a pivot table in the first sheet which includes the field "Date" as a column label.

In the remaining sheets, except for one, there are pivot tables based on the same underlying dataset which also include the field "Date" as a column label.

I would like to adjust the selection (i.e., exclude some dates) from the column label in the first sheet and see if it is possible to make the same adjustments automatically to the pivot tables in the remaining sheets as well.

note that the field "Date" is used as a Column label, i.e., it is not a Report filter.

View 3 Replies View Related

Change Pivot Source Data In Multiple Pivot Tables?

Jan 21, 2013

I have a single workbook with multiple worksheets. Each worksheet has a different pivot table displaying a different view of the data. Each pivot table uses the same source data at worksheet1.

Each week i add new data to the end of the source data, which means that I need change the source data reference separately in each pivot table to update each pivot table view to include the new data. This is laborious as there are quite a few pivot tables.

Was wondering if there is some way of changing the pivot table source data reference on all pivot tables at the same time.

View 4 Replies View Related

Pivot Table Based Off Multiple Pivot Tables

Sep 5, 2006

Is it possible to create pivot table from another multiple pivot table.

Example: I have two diff pivot table "Income" and "Expense" as well
and I need to preapare new pivot table using with those two pivot table

View 3 Replies View Related

Sort Multiple Pivot Tables

Jul 15, 2014

with this macro?

I have a lot of pivot tables on multiple sheets in one workbook.

I want to deselect all "(blank)" from rows, and sort both rows and columns in ascending order.

I recorded a macro but it only refers to specific pivot tables, I would like it to do the same sorting for all pivot tables in the workbook.

Sub PivotBlankSort()
'
' PivotBlankSort Macro
'
'
Windows("Alt Assessment Y10 13-14.xlsx").Activate
Sheets("L&C Prog Sum2").Select
With ActiveSheet.PivotTables("PivotTable10").PivotFields("English")
.PivotItems("(blank)").Visible = False

[Code]...

etc as I move to each separate pivot table.

View 2 Replies View Related

Creating Multiple Pivot Tables Using VBA

Apr 1, 2009

I am having a lot of trouble with pivot tables in Excel 2007 VBA. I am trying to create pivot tables using macros (connected to buttons the user can press to create the pivot table) - please don't ask why, but i need to do this!!!

I used the record fuction in excel 2007 to produce macro code which will produce the required pivot tables when the user presses a button.

Unfortuanately the coding seems to work fine when i have one pivot table in a file but breaks down if i record code to produce another pivot table.

I have attached some code below (which was produced by the record function) and is intended to produce 2 seperate pivot tables (the macro submacro2 produces the 1st pivot table and the macro submacro4 lower down the page produces the 2nd pivot table). I have also indicated the point in sub 4 where the code breaks down - basically submacro4 just doesnt run!

View 14 Replies View Related

Pivot Tables Multiple Worksheets

Nov 17, 2009

Background: I know ZERO about VBA and I am a Vlookup & Pivot Table noob, but experimenting everyday.

Every week, since August 29, 2009, I get a sales report from my customer in raw form showing point of sales data for the previous 7 days. After manipulating the data I end up with 11 columns.

Now, if I am only concerned with that one week then I can drop the whole sheet into a Pivot Table and all is well.

However, I have 12 sheets now (with more to come), one for each week, and the row count ranges from 3,328 to 16,414.

I do not want to consolidate the data.

I can copy everything to one sheet, and hope not to max out at the million row mark, but would prefer to keep it tabbed by week.

View 2 Replies View Related

Pivot Tables With Multiple Rows?

Sep 21, 2013

This is my data:

This is the Pivot Table I created:

The Pivot Table is exactly what I want and I like that I can also sort by school or district. The problem: Cells B6 through E6 show up with correct information but the totals below that are all wrong. They seem to pull the same data from question 4.

View 3 Replies View Related

Syncing Pivot Tables In 1 Tab And Multiple Tabs

Jan 22, 2014

For data I am using 1 pivot table. I have 4 tabs which use this pivot table to present different data on each tab.

For the first question, I have the same pivot table in the sheet twice in order to have multiple pivot charts with similar data but setup differently. I found this to be the simplest solution to presenting the data in the manner I want to see it. Otherwise I wish to set the tables up so that if I change a filter in one of the tables that the data is automatically updated to both tables.

The second question, this relates to the first question somewhat. I wish to change filters in 1 pivot table from tab one, and once that tab is updated I wish for all of the other tabs with this same pivot table to automatically update with the filter changes from the first time.

View 3 Replies View Related

Control Multiple Pivot Tables With Formula?

Oct 25, 2011

I have 3 different pivot tables (with 3 different data sources) on 3 seperate sheets (sheet2, sheet3 & sheet4). Each pivot table has a report filter which contains employees names. On sheet 1 I have a sort of 'dashboard' set up feeding from the data in the pivot tables, and a combo box form control from which I can select the employees names.

Currently, if I want to see John's data, I need to go to Sheet1 and select 'John' from the report filter, then goto Sheet2 and select 'John' from the report filter & the same for Sheet 3. I was wondering if it is possible to somehow link the pivot tables to the combo box - so that when I select 'John' from the combo box on Sheet1, it automatically selects 'John' in the report filters on sheets 2,3, & 4.

View 9 Replies View Related

Combine Multiple Pivot Tables On One Report?

Apr 21, 2014

I have to track how well location managers are keeping track of skill competencies.

We rate skills as...
0 – know nothing ,
1 – read training manual,
2 – check off by manager.

I need the managers to provide these ratings then I have to report what locations need more training. When an new employee is entered into the system, the manager should give them a target of 2 for each skill the employee needs to gain. If the target skill is 2 rating higher than the current skill level, I have a column named Delta that records a 2.

I have learned how to use the pivot table feature. I can make separate pivot tables using filters that show…
a) how many 2s each employee has for a target,
b) how many 2s each employee has for deltas,
a) how many 2s each employee has for a current level and I can show the date the 2s where achieved

What I need is to learn how to combine all of this information on one pivot table (or report), but the filters really seem to make a mess of it all when it is all together. adding multiple sheets to one Pivot table.

Screenshots...
Count of Targets
Count of Deltas=2
Count of Current Skills
!What I need to produce!

[Code].....

View 1 Replies View Related

Filter Multiple Pivot Tables Based On Same Cell Value

Jun 15, 2012

I am trying to update multiple pivot tables from different OLAP cubes based on the same cell value that an user defines,
namely one country for which he/she wants the create the report for. The code I recorded goes like this:

VB:
Sub TUR()

Sheets("Pivot").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("[Geography].[Geography]"). _
ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("[Geography].[Geography]"). _
CurrentPageName = "[Geography].&[TUR]"
End Sub

In this example, TUR stands for Turkey.

Basically, I have over 20 countries and at least 3 different OLAP cube-based pivot tables in my report, I can do it with 3 x 20 different macros but that seems like taking the long way.

View 2 Replies View Related

How To Update A Column Label For Multiple Pivot Tables At Once

Aug 24, 2014

I have ~ 300 pivots (one on each tab) all linking to one data set in the same workbook. I realized that I neglected to select the year 2006 in my column label for every pivot table and hoping that there is some way to

simultaneously update all pivots to include 2006 data instead of manually checking the box off one by one.

View 2 Replies View Related

Linking Pivot Tables - Multiple Page Fields

Feb 16, 2010

I have two pivot tables on one sheet and I want the page fields on the second to change when I change the first pivot table. I found the below code and have applied it to one of the three page fields I have, but can't seem to duplicate it for the other page fields:

View 7 Replies View Related

One Slicer For Multiple Pivot Tables With Different Data Source

May 2, 2013

I have multiple pivot tables with different data source. I wish to have one slicer which control all the pivot tables. I would have one common colum for all the pivot tables which is the one i wish to control for instance the person in charge. Note that all my pivot tables are from different data source. how to do it?

View 1 Replies View Related

Update Source Data For Multiple Pivot Tables With VBA

Dec 16, 2013

The spreadsheet is comprised of 4 sales data sheets, one for each store. Each of these sales data sheets runs several pivot tables (One for dept sales, one for waste, one for sales on Selected UPCs etc) and I used to have 1 copy of each pivot table for each store (ie 24 pivot tables). Now I have found a way to have only 1 copy of each PivotTable which changes based on which store is selected using the following code:

Code:
Sheet13.PivotTables ("Top10LW").PivotTableWizard SourceType:=xlDatabase, SourceData:= _
.List(.Value)

This works great however I was repeating it for every pivot table I had in the spreadsheet, causing messy code and file corruptions.

Is there any code which I can use for updating all pivot tables, using as minimal code as possible, all in one hit?

View 3 Replies View Related

Combine Data From Multiple Worksheets - Pivot Tables

Sep 20, 2009

I am trying to combine sorted data from 2 worksheets to a new work sheet to process further. I have one worksheet with order number, part number, order qty but with different delivery dates. On another worksheet, I have the order number too, part number, the qty delivered. The qty delivered is not always the same each delivery.

My aim is to find out how many are already delivered under a certain purchase order and the balance of undelivered parts.

I used pivot tables to sort out the data but I am stuck here not knowing how to extra the sorted data from the pivot tables to the 3rd worksheet. I will need to match the order number and the part number.

View 9 Replies View Related

Macro Create Pivot Tables?

Jun 27, 2007

I created a macro by using the macro recorder. It creates some columns and formulas and does some formatting, then it is to take the data and create some pivot tables.

for some reason it gets stuck on the first pivot table. It creates it, but it wont add the first field to the table.

View 4 Replies View Related

Macro To Create Pivot Tables

Oct 22, 2006

I have recorded a Macro to create Pivot Tables, I would like this to run in any workbook. The problem is that every time a Pivot Table is generated Excel alters the number of the table(Pivot Table options). This then does not match that in the Macro as below("PivotTable1").

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R37C6").CreatePivotTable TableDestination:="", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet. Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("GAME")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("LANGUAGE")
.Orientation = xlRowField
.Position = 2

View 2 Replies View Related

Multiple Pivot Tables - Single Table Of Source Data

Mar 9, 2014

I am trying to generate several pivot tables from one data source table. I have successfully created my first pivot table (A date field, and a water storage facility level reading) and subsequently a graph from this. I have worked out that I need to group my dates as I am supplied a daily reading, but only need monthly average. All worked great.

Now i need to create more pivot tables and graphs. The next one I want is to create one grouped by years. But when I create this new pivot table and change the grouping of the date field to yearly, it also changes the grouping on my first pivot table, which is undoing my work.How to tell excel that these pivots are independent, and I don't want them changing in unison? See screen grab of my source data and where I am up to...

Microsoft Excel - 401027_0100.00_0221.00.csv_2014-03-10_11-41-35.jpg

View 1 Replies View Related

Macro/Code Required For Calculations Base On Pivot Tables Sum

Jan 29, 2009

What I required is either a Macro or Code for formulas in column 'F' in the attached spreadsheet that correspond to the SUM of each description and divided by 37.5 e.g. in F10 the formula should be =D10/37.5 the formula should be F12 D10/37.5 and so on all the way down the Pivot table

My problem is as the amount data increases on the Data Tab the formulas in column 'F' will become out of line with the corresponding Sum of each description so I guess I need some code or formula that check every time the Pivot table is refreshed.

View 3 Replies View Related

Macro To Create Pivot Tables And Sort Out Data In Other Worksheet

May 19, 2009

The first sheet is the row data given to me, the second one is where I want my data to be analysed automatically by macros.

I managed to create a pivot table manually to give me the info I want but then I still have to copy all the results from the pivot table sheet to my analysis sheet.

How can I create a macro able to do all that by it self? I tried to record a macro using the recorder but then when I try to play it it gives me an error straight at the beginning in the definition of the pivot table I think.

An example of what I want the pivot table to do is:
in the first sheet, go in the small table in column K and L, take the value of L1, then in the row data in column A to J, in column C look for the value in L1, once found, look for the value 1 in column J then do the average on the values in column E and put the result in my second sheet in cell F5
then do the same but look for 2 in column J and put it in F8, then 3 in F11, ... until 7 found (the data is in ss.000 and so the results in the second sheet should be formated the same way)
then do the same all over again for value in L2
etc etc etc

this should be done for the 6 values in column L, each having values up to 7 in the J column.

Then I need to do the same for other columns and not only averages but minimums as well but I can adapt the code I think.

View 14 Replies View Related

Refresh Pivot Tables Linked To Pivot Table

Jul 25, 2006

I currently have several pivot table that's linked to a single pivot table(let's call it X) in the same workbook. I'm doing this to limit the file size because the data in X comes from a text file that has millions of lines. However, it's such a pain every time I need to update the tables because simply clicking "refresh" does not update those tables that are linked to X with new data. I would have to instruct the wizard in every linked table to point to X every time. I'm trying to write a small program to re-point to X for each of those other pivot tables whenever i refresh data. However, after trying to record the steps to do this I'm still unable to run these

Sub Macro1()

ActiveSheet.PivotTableWizard SourceType:=xlPivotTable, SourceData:= _
"PivotTable1"

End Sub

View 6 Replies View Related

Excel 2010 :: Creating Multiple Tables In VBA And Referring To Newly Created Tables?

Jul 1, 2013

Using Excel 2010. I'm writing a macro that sets up a workbook to be used for estimating at the beginning of a project. In the code I need to create multiple tables (formerly known as "lists") in the workbook. Then later in the code I need to refer back to those newly created tables. Currently, the code that creates the table is part of a loop that creates the table on many different worksheets. The problem of course, is that I have to name the Table, and then it won't create a table of the same name on the next sheet. Then, later in the code, I need to make adjustments to the table that was just created before looping to the next sheet.

Is there a way to create a table without giving it a constant name? Or by giving it a name that builds off of other info in the sheet? For example, I would be good with the naming the table after the sheet name: "Sheet1_Table" or such.

Code:
Sub Auto_Open()
'
Dim sht As Worksheet
If Range("A1") = 1 Then

[Code].....

View 2 Replies View Related

Running One Macro For Multiple Workbooks?

Apr 7, 2014

I have approximately 30 workbooks for which i open and run a macro to change the look and feel for client perusal.

I normally open each of the 30 workbooks and run the macro for each one.

Is there a way I can run the macro to apply to all workbooks at once?

View 3 Replies View Related

Running Macro In Multiple Worksheets?

Dec 20, 2013

I am seeking code that will go to Sheet 4 (named "Extract"), copy a1:a5 and return to the active cell the macro was launched from and copy the values in.

The challenge I am having is how to get the code to return back to the cell it was launched from since I want the flexibility to use this macro in multiple tabs/sheets to copy the info into ANY selected cell within ANY sheet. As it is now, I have to go change the sheet name each time for the then active sheet.

I've attempted to insert a generic worksheet reference, however I end up with a debug issue.

Sub Macro10()
'
' Macro10 Macro

[Code].....

View 2 Replies View Related

Running Macro On Multiple Sheets

Jun 30, 2006

I would like to run the code below on selected sheets in my workbook:

Range("B9:AW38, AZ9:BE38, b3").ClearContents

I tried using this but it doesn't work:

Sub clear()
Sheets( Array("sheet A", "sheet B", "sheet C")).Select
Range("B9:AW38, AZ9:BE38, b3").ClearContents
End Sub

View 2 Replies View Related

Can Pivot Table Be Created From Several Other Pivot Tables

Mar 5, 2014

I have 12 months worth of data in twelve separate workbooks each with a pivot table, I have copy/moved the pivot table tab from each into one workbook so now I have a workbook that consists of 12 tabs each with a pivot table. What I would like to be able to do is create a summary table with the full years data; where I am running into problems is that each months table has slightly different row and column counts and labels making any formula like =sum([sheet 1 cell a1]+[sheet 2 cell a1]) problematic.

View 3 Replies View Related

Pivot Tables: Pivot Table Layout

Oct 14, 2003

if there is a way to display a table as column percentages but have the totals as raw numbers.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved