Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub CleanMyPivots()
'SkipVought/2007 Apr 30/
'--------------------------------------------------
'cleans up pivot tables having OLD/UNUSED data hanging around.
'--------------------------------------------------
Dim pc As PivotCache
For Each pc In ActiveWorkbook.PivotCaches
pc.MissingItemsLimit = xlMissingItemsNone
pc.Refresh
Next
End Sub
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'X Offset'!R1C1:R6066C3").CreatePivotTable TableDestination:="", TableName _
:="X Offset PT", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
With ActiveSheet.PivotTables("X Offset PT")
.ColumnGrand = False
.RowGrand = False
End With
ActiveSheet.PivotTables("X Offset PT").AddFields RowFields:="Y", _
ColumnFields:="X"
ActiveSheet.PivotTables("X Offset PT").PivotFields("X Offset").Orientation = _
xlDataField
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'X Offset'!R1C1:R5458C3").CreatePivotTable TableDestination:="", TableName _
:="PivotTable1", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable1")
.ColumnGrand = False
.RowGrand = False
End With
ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:="Y", _
ColumnFields:="X"
ActiveSheet.PivotTables("PivotTable1").PivotFields("X Offset").Orientation = _
xlDataField
dumy = "'X Offset'!R1C1:R" & Ccolumn & "C3"
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
dumy).CreatePivotTable TableDestination:="", TableName _
:="X Offset PT", DefaultVersion:=xlPivotTableVersion10
'ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"'X Offset'!R1C1:R6066C3").CreatePivotTable TableDestination:="", TableName _
:="X Offset PT", DefaultVersion:=xlPivotTableVersion10