

I am new to coding and need some help please I am not sure if it is because of something in my data range definition section or in the data field insertion section… I have copied and pasted the sections I feel might be where the issue is arising.
#Pivot graph in excel for mac code
I used the generic code provided and did some edits to fit what I am attempting to do, the only issue is that my pivot table isn’t actually showing up in my new PivotTable worksheet. TableActiveSheet.PivotTables(“PivotTable1”).ShowTableStyleRowStripes = TrueActiveSheet.PivotTables(“PivotTable1”).TableStyle2 = “PivotStyleMedium9” With ActiveSheet.PivotTables(“PivotTable1”).PivotFields(“Amount”) With ActiveSheet.PivotTables(“PivotTable1”).PivotFields(“Frequency”) With ActiveSheet.PivotTables(“PivotTable1”).PivotFields(“Applicable”) With ActiveSheet.PivotTables(“PivotTable1”).PivotFields(“Threshold result”) (TableDestination:=PSheet.Cells(1, 1), TableName:=”PivotTable1″) Set PRange = DSheet.Cells(4, 2).Resize(LastRow, LastCol)ĬreatePivotTable(TableDestination:=PSheet.Cells(3, 1), _ I guess it is struggling to get the data from the source but honestly i’m not sure. , “Author”).Slicers.Add ActiveSheet,, “Author”, “Author”, 122.4, 496.2, 144, _įor some reason my code only seems to be creating the tab and no creating the pivot table. (TableDestination:=PSheet.Cells(1, 1), TableName:=”TeamQualityMetric1″)Ī2(ActiveSheet.PivotTables(“TeamQualityMetrics1”) _ (TableDestination:=PSheet.Cells(19, 1), TableName:=”TeamQualityMetrics”) Set PSheet = Worksheets(“Team Quality Metrics”)ĬreatePivotTable(TableDestination:=PSheet.Cells(20, 2), _ Worksheets(“Team Quality Metrics”).DeleteĪctiveSheet.Name = “Team Quality Metrics” Using this code I created 2 pivot tables in one sheet and trying to connect 1 slicer with both the tables but in Slicer Connection settings I don’t find option to select another table. With ActiveSheet.PivotTables(“SalesPivotTable”).PivotFields(“Local Legal Entity Code”) MissingItemsLimit = xlMissingItemsDefaultĪctiveSheet.PivotTables(“SalesPivotTable”).RepeatAllLabels xlRepeatLabels With ActiveSheet.PivotTables(“SalesPivotTable”).PivotCache With ActiveSheet.PivotTables(“SalesPivotTable”) “PivotTable!R1C1″, TableName:=”SalesPivotTable”, DefaultVersion:=6 PRange, Version:=6).CreatePivotTable TableDestination:= _ Set PRange = DSheet.Cells(1, 1).Resize(LastRow1, LastCol)Ī(SourceType:=xlDatabase, SourceData:= _ I have delete that part of the code and add it like this and it is working for me: With ActiveSheet.PivotTables("SalesPivotTable").PivotFields ("Amount")ĪctiveSheet.PivotTables("SalesPivotTable").ShowTableStyleRowStripes = TrueĪctiveSheet.PivotTables("SalesPivotTable").TableStyle2 = "PivotStyleMedium9" With ActiveSheet.PivotTables("SalesPivotTable").PivotFields("Zone") With ActiveSheet.PivotTables("SalesPivotTable").PivotFields("Month") With ActiveSheet.PivotTables("SalesPivotTable").PivotFields("Year") (TableDestination:=PSheet.Cells(1, 1), TableName:="SalesPivotTable") _ĬreatePivotTable(TableDestination:=PSheet.Cells(2, 2), _ (SourceType:=xlDatabase, SourceData:=PRange). Set PRange = DSheet.Cells(1, 1).Resize(LastRow, LastCol) LastCol = DSheet.Cells(1, Columns.Count).End(xlToLeft).Column The document attached has these instructions with visuals so you can see how this is done.LastRow = DSheet.Cells(Rows.Count, 1).End(xlUp).Row Your list will appear in the sort order you just made, AND when you make a pivot table, it will appear in that order as well.


The easiest way to do this is with a custom list. How do I get these to show up in this order as column labels in my pivot table? As we go through the list, items are grouped by where they are in the collection and according to past worksheets. The first two items are the main shelving units in our collection which we want to appear in the first two columns. RefFloor1, RefTier2, ShortShelf, HIDesk, TestAssess, Encyc, 188/MPS, Atlas, College, Career, Rm161, ANSI I am going to use a list we use to provide reports for our reference collection measurements. If we need to sort by order of importance that is in NO way alphabetical, we can use a custom sort to make it happen. The default in a pivot table is alphabetically. Once in a while, we have lists that we need to sort in custom ways.
