Hey!
I am getting an error while running the code mentioned below to create a dynamic pivot....
Let me know if anyone can help me....
<code>
Range("A1").Select
ActiveWorkbook.Names.Add Name:="Pivot", RefersToR1C1:= _
"=OFFSET(Data!R1C1,0,0,COUNTA(Data!C1),COUNTA(Data!R1))"
ActiveWorkbook.Names("Pivot").Comment = ""
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Pivot", Version:=xlPivotTableVersion14).CreatePivotTable TableDestination _
:="Audits!R3C1", TableName:="PivotTable2", DefaultVersion:= _
xlPivotTableVersion14
Sheets("Audits").Select
Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _
"PivotTable2").PivotFields("Report ID"), "Count of Report ID", xlCount
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Business Unit")
.Orientation = xlRowField
.Position = 1
End With
End Sub
</code>
Bookmarks