Dynamic selection Pivot

harshab6

Active Member
Joined
Oct 1, 2008
Messages
254
Hi,

I am trying to Run the dynamic selection Pivot tab,its reflecting a error as Invalid procedure call or argument I have bolded the code lines which reflect error .I am unable to figure out what went wrong.


Sub Macro2()
'
' Macro2 Macro
'
'
Range("N3").Select
Application.CutCopyMode = False
Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"myData", Version:=6).CreatePivotTable TableDestination:= _
"[Trial.xls]Trial!R3C14", TableName:="PivotTable2", DefaultVersion:=6
ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _
"PivotTable2").PivotFields("G/L acct"), "Sum of G/L acct", xlSum
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Sum of G/L acct")
.Orientation = xlRowField
End With
ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _
"PivotTable2").PivotFields("Beganning Balance"), "Sum of Beganning Balance", _
xlSum
ActiveWindow.SmallScroll ToRight:=2
ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _
"PivotTable2").PivotFields(" Accumulated balance"), _
"Sum of Accumulated balance", xlSum
Range("Q3").Select
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top