Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pulling Data From PivotTable
I am writing a macro to extract data from a PivotField which is part
of my PivotTable (included) and the corresponding data from a PivotField which is only in the PivotTable Field list (non-included). I have not been able to get the data points from the two fields to match up as I have only been able to get the data from the second (non- included) field in alphabetical order. The data as I need it would look like this.... Included field: Apple, Banana, Pear Non-included field: Red, Yellow, Green ..... but what I'm getting is this..... Included field: Apple, Banana, Pear Non-included field: Green, Red, Yellow The problem is further complicated when I am pulling only visible items from the PivotTable, (i.e. Apple and Pear when Banana is hidden) where non-included items do not distinguish between visible and hidden. The data is in an external data source (a database) and so am looking to pull it in though the PivotTable. Below is my macro that pulls the data back incorrectly. Set pTbl = ThisWorkbook.Sheets(1).PivotTables(1) rw = 0 For Each frt In pTbl.PivotFields("Fruit").PivotItems rw = rw + 1 With Sheets("Sheet2") ..Cells(rw, 1).Value = frt.Name ..Cells(rw, 2).Value = pTbl.PivotFields("Color").PivotItems(rw).Name End With Next |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pulling data from other wb based on data to populate dropdown list | Excel Discussion (Misc queries) | |||
Creating a PivotTable w/o selecting data in an existing PivotTable | Excel Discussion (Misc queries) | |||
Tying to extract all data from a pivot pulling from external data | Excel Discussion (Misc queries) | |||
Linking two spreadsheet, pulling data from one cell to another, data is being truncated | Excel Worksheet Functions | |||
Saving worksheet as CSV after pulling data from an external data source | Excel Programming |