How to use GETPIVOTDATA() in VBA???

stevenmcheerful

New Member
Joined
Apr 16, 2002
Messages
20
My first time trying to use GETPIVOTDATA() in a VBA macro failed. Application.Worksheet.GetPivotData does not even seem to exist as a function in the Worksheet Object.

Does anyone know how to use GetPivotData function from VB?

thanks

- steve
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Should be something like this:<pre>Sub T()
Dim PT As PivotTable
Set PT = Sheet1.PivotTables(1)

MsgBox PT.GetPivotData("DataField", "Field1", "Item1", "Field2", "Item2").Value
End Sub</pre>

Look on the Help for the valid structure, and required parameters.

_________________
Regards,

Juan Pablo G.
MrExcel.com Consulting
This message was edited by Juan Pablo G. on 2002-08-25 15:19
 
Upvote 0
This is the example I have available on the Help files:

<pre>Sub UseGetPivotData()

Dim rngTableItem As Range

' Get PivotData for the quantity of chairs in the warehouse.
Set rngTableItem = ActiveCell. _
PivotTable.GetPivotData("Quantity", "Warehouse", "Chairs")

MsgBox "The quantity of chairs in the warehouse is: " & rngTableItem.Value

End Sub</pre>
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,048
Latest member
81jamesacct

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