I am using a pivot table with Page items being dates of transactions and want to be able to use a Combo-Box on another sheet to select the required date. I have looked at Getpivotdata etc and various basic VB codes but am a bit lost. Can anyone advise please?
Use the PivotItems method to return the PivotItems collection. The following example creates an enumerated list of field names and the items contained in those fields for the first PivotTable report on Sheet4.
Worksheets("sheet4").Activate
With Worksheets("sheet3").PivotTables(1)
c = 1
For i = 1 To .PivotFields.Count
r = 1
Cells(r, c) = .PivotFields(i).Name
r = r + 1
For x = 1 To .PivotFields(i).PivotItems.Count
Cells(r, c) = .PivotFields(i).PivotItems(x).Name
r = r + 1
Next
c = c + 1
Next
End With
Use PivotItems(index), where index is the item index number or name, to return a single PivotItem object. The following example hides all entries in the first PivotTable report on Sheet3 that contain "1998" in the Year field.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.