我可以使用VBA在行中爲「Pog Group」和「Item#」編寫代碼。然後,我想在此數據透視表中通過VBA多次計算每個Pog組中的Item#重複次數。我可以總結他們,但我不知道如何計算它們。在下面的圖片中,編碼可以實現左側數據透視表上的效果,但我想在右側實現效果。非常感謝您的幫助!!!您好我想用VBA來計算數據透視表
Sub creatpivottable2()
Dim PT As PivotTable
Dim PTCache As PivotCache
Worksheets("SKU & POG DataResource").Select
Set PTCache = ActiveWorkbook.PivotCaches.Create(xlDatabase, Cells(1, 1).CurrentRegion)
Set PT = ActiveSheet.PivotTables.Add(PivotCache:=PTCache, TableDestination:=Range("E4"))
With PT
.PivotFields("POG Group").Orientation = xlRowField
.PivotFields("Item #").Orientation = xlRowField
.PivotFields("Trait #").Orientation = xlDataField
End With
End Sub
請看我上傳的圖片,顯示我現在認識的影響,我想顯示效果。問題是如何使用數據在Pivotfields –
hmm ..嘗試宏記錄?其良好的參考來源 – Rosetta