在线获取类型不匹配tabledestination:=("pivot!A3")
我想添加一个工作表并将其命名为“数据透视表”并在该工作表上创建数据透视表。
Dim pt As PivotTable
Dim Pcache As PivotCache
Sheets.add.name = "Pivot"
Sheets("DATA").Select
Set Pcache = ActiveWorkbook.PivotCaches.Create(xlDatabase, Cells(1, 1).CurrentRegion)
Set pt = ActiveSheet.PivotTables.Add(PivotCache, tabledestination:=("pivot!A3"))
With pt
PivotFields.Subtotals(1) = False
.InGridDropZones = True
.RowAxisLayout xlTabularRow
.PivotFields("Apple").Orientation = xlRowField
.PivotFields("Apple Qty").Orientation = xlDataField
End With