Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pivot Chart: referencing the underlying Pivot Table

Status
Not open for further replies.

tyemm

Technical User
Feb 28, 2005
66
US
When I look today at the pivot chart I created yesterday, I have a problem "finding" the pivot table from which I created it. I cannot right-click, or find the "source data" or "series" readily at hand. Indeed even recreating what I have done is tricky, making documentation a problem.

What is the best way to keep track of this table, so that I don't end up accumulating material I don't need/want? Is there a tutorial on this aspect precisely? For example, I'd also like to embed a pivot chart in a cell, so that I can use the camera tool and display the chart in a dashboard, etc.

Thanks,
Tom
 





Hi,

Do you have multiple PivotTables in your workbook?

If so, do each of them point to a different data source?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 



This may help you "find" the info. Paste in a module and run from the Tools > Macro > Macros menu ...
Code:
Sub PivotChartLocations()
    Dim ch As Chart
    For Each ch In Charts
        With ch.PivotLayout.PivotTable.TableRange1
            MsgBox ch.Name & ":" & .Parent.Name & "!" & .Address
        End With
    Next
End Sub

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks Skip--
When I created that Module and tried to run it, I get:
Object variable or With block variable not set (Run-time error '91'). And the answer to your first question is: I'm not sure--but the fact that one of them comes up as PivotTable3 (not so named by me!) suggests that I have or at least had as many as three. Not intentionally, and I'm not sure if even necessary. My original raw data table is singular, and not so special. But, as a for instance, I have the Time of events (e.g. 07:13) and I'd like to sort by Shift (shift one = 7AM to 3PM, etc.) and I did this (somehow) a week ago, and I have a nice enough chart, but now I cannot retrace my steps and it feels like Hansel & Gretel!
 




try this instead...
Code:
Sub PivotChartLocations()
    Dim ch As Chart
    For Each ch In ActiveWorkbook.Charts
        With ch.PivotLayout.PivotTable.TableRange1
            MsgBox ch.Name & ":" & .Parent.Name & "!" & .Address
        End With
    Next
End Sub


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top