PDA

View Full Version : pivot vba



abraham30
02-28-2013, 01:07 PM
Hi all,

I want to refresh my pivot (made from "Raw data") by simply writing the VBA code.

Data from sheet "Raw data" are frequently changed by end-user manually.
Both column and row are in dynamic range

This is the recorded macro.


sub macro()
Sheets("Overview").Select
ActiveSheet.PivotTables("PivotTable4").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"C:\Desktop\[asd.xlsm]RAW DATA!R1C1:R30C6", Version:= _
xlPivotTableVersion14)

ActiveSheet.PivotTables("PivotTable4").PivotCache.Refresh
End Sub