Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Simple GetData Question

Hi,
I'm trying to use VBA to pull data from a Pivot Table and keep getting errors

Below is a simple example:
My Pivot Table Sheet Name defined in VBA is "PivOpp"
The Pivot Table on the sheet is named: "Opps Pivot"
I have a field called "Confidence Sales Calculation" & "Sourcing Year"
'Confidence Sales Calculation' is a field which I want summed up in a total.
The Field 'Sourcing Year' has a valid item called "2009".
I want to get a sum of the 'Confidence Sales Calculation' for 2009.

I keep getting runtime error 1004 with both of the below examples.
Sub MyTest is how I tried using GetData
Sub UseGetPivotData is straight out of the help file just modifing the fields.
I'm not sure what the problem is and why methods work.

Thanks for any help!


Sub MyTest
dim test2
test2 = PivOpp.PivotTables("Opps Pivot").GetData("'Sum of Confidence
Sales' Calculation' Sourcing Year 2009")
End Sub

Sub UseGetPivotData()

Dim rngTableItem As Range

' Get PivotData for the quantity of chairs in the warehouse.
Set rngTableItem = ActiveCell. _
PivotTable.GetPivotData("Confidence Sales Calculation", "Sourcing
Year", "2009")

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

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Simple GetData Question

Let me elaborate....
The pivot table doesn't have all of these fields in the table itself...
Sourcing Year is actually above the table as a select box.
Maybe a better way to say it is that:

I want to pull data from the pivot table range without the limitations of
how the pivot table currently is structured...
Not sure if that makes sense or not.

Thanks, MikeZz

"MikeZz" wrote:

Hi,
I'm trying to use VBA to pull data from a Pivot Table and keep getting errors

Below is a simple example:
My Pivot Table Sheet Name defined in VBA is "PivOpp"
The Pivot Table on the sheet is named: "Opps Pivot"
I have a field called "Confidence Sales Calculation" & "Sourcing Year"
'Confidence Sales Calculation' is a field which I want summed up in a total.
The Field 'Sourcing Year' has a valid item called "2009".
I want to get a sum of the 'Confidence Sales Calculation' for 2009.

I keep getting runtime error 1004 with both of the below examples.
Sub MyTest is how I tried using GetData
Sub UseGetPivotData is straight out of the help file just modifing the fields.
I'm not sure what the problem is and why methods work.

Thanks for any help!


Sub MyTest
dim test2
test2 = PivOpp.PivotTables("Opps Pivot").GetData("'Sum of Confidence
Sales' Calculation' Sourcing Year 2009")
End Sub

Sub UseGetPivotData()

Dim rngTableItem As Range

' Get PivotData for the quantity of chairs in the warehouse.
Set rngTableItem = ActiveCell. _
PivotTable.GetPivotData("Confidence Sales Calculation", "Sourcing
Year", "2009")

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

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF formula-simple question; simple operator Rich D Excel Discussion (Misc queries) 4 December 6th 07 03:36 PM
getdata macro with selection Sevenyor Excel Programming 0 March 15th 07 09:06 PM
GetData SanctifiedRock[_8_] Excel Programming 0 July 12th 06 09:34 PM
Simple Simple Excel usage question BookerW Excel Discussion (Misc queries) 1 June 23rd 05 10:06 PM
simple question, hopefully a simple answer! Matt B Excel Programming 5 January 13th 04 08:43 PM


All times are GMT +1. The time now is 01:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"