Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
What is the syntax to delete a pivottable programatically? I tried Dim ws As Worksheet Dim pt As PivotTable Set ws = ActiveWorkbook.Worksheets("unused") Set pt = ws.PivotTables(1) pt.Delete ' error Set pt = Nothing Thanks Habib |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ws.PivotTables(1).DataBodyRange _
.CurrentRegion.EntireColumn.Delete or .clearcontents if there is data below the pivottable set pt = ws.PivotTables(1) ws.range(pt.pagerange,pt.databodyrange).Clear -- Regards, Tom Ogilvy "HSalim[MVP]" wrote in message ... Hi What is the syntax to delete a pivottable programatically? I tried Dim ws As Worksheet Dim pt As PivotTable Set ws = ActiveWorkbook.Worksheets("unused") Set pt = ws.PivotTables(1) pt.Delete ' error Set pt = Nothing Thanks Habib |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
Thanks for the quick response. I took your example with a twist - ws.PivotTables(1).DataBodyRange _ .CurrentRegion.EntireRow.Delete Regards and Merry Christmas Habib "Tom Ogilvy" wrote in message ... : ws.PivotTables(1).DataBodyRange _ : .CurrentRegion.EntireColumn.Delete : : : or .clearcontents : : : : if there is data below the pivottable : : : : set pt = ws.PivotTables(1) : ws.range(pt.pagerange,pt.databodyrange).Clear : : : : -- : : Regards, : : Tom Ogilvy : : : : "HSalim[MVP]" wrote in message : ... : Hi : What is the syntax to delete a pivottable programatically? I tried : : Dim ws As Worksheet : Dim pt As PivotTable : : Set ws = ActiveWorkbook.Worksheets("unused") : : Set pt = ws.PivotTables(1) : pt.Delete ' error : Set pt = Nothing : : Thanks : Habib : : : : |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
trying to delete a row in the pivot table for the pivot chart | Excel Discussion (Misc queries) | |||
Delete Pivot Table Formula | Excel Discussion (Misc queries) | |||
Delete some substotal in a pivot table | Excel Discussion (Misc queries) | |||
Delete pivot table | Excel Programming | |||
Delete Pivot Table | Excel Programming |