Re: VBA, PivotTable, Drill DOwn
Hey Matt-
So this is what i came up with, it aint pretty and assumes that the grand total cell you want to double click on is in the bottom right cell of the pivot table, but it works- see below:
Code
Public Sub ShowAllPTDetail()
Dim WB As Workbook
Dim wsCounter As Long
Dim ptCounter As Long
Dim pt As PivotTable
Dim dataRange As Range
Set WB = ThisWorkbook
For wsCounter = 1 To WB.Sheets.Count
If WB.Sheets(wsCounter).PivotTables.Count > 0 Then
With WB.Sheets(wsCounter)
For ptCounter = 1 To .PivotTables.Count
Set pt = .PivotTables(ptCounter)
Set dataRange = Range(pt.TableRange1.Address)
dataRange(dataRange.Rows.Count, dataRange.Columns.Count).Select
Selection.ShowDetail = True
Next
End With
End If
Next
End Sub
Display More
Hope this helps,
TheSilkCode