Pivot chart, problem drilling through to underlying data.

Ronanm

Board Regular
Joined
Nov 13, 2010
Messages
107
Using the code below I can click on a Pivot Charts column and drill down to the data, but the Pivot Chart needs to be a "Pivot Chart" sheet.

I can't get it to work when I change the location of the "PivotChart" and embed it in an ordinary worksheet.

Does anyone know how I could manage that....


Private Sub Chart_MouseUp(ByVal Button As Long, ByVal Shift As Long, _
ByVal x As Long, ByVal y As Long)
Dim ElementID As Long
Dim Arg1 As Long
Dim Arg2 As Long


ActiveChart.GetChartElement x, y, ElementID, Arg1, Arg2

' If clicked, show detail
If ElementID = 3 Then
ActiveChart.PivotLayout.PivotTable.DataBodyRange. _
Cells(Arg2, Arg1).ShowDetail = True
ActiveSheet.Cells(2, 2).Select
ActiveWindow.FreezePanes = True
End If
ErrHandler:

If Err.Number <> 0 Then MsgBox _
"Chart_MouseUp - Error#" & Err.Number & vbCrLf & _
Err.Description, vbCritical, "Error", Err.HelpFile, Err.HelpContext
On Error Resume Next
On Error GoTo 0

End Sub


Ronan
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,214,654
Messages
6,120,758
Members
448,991
Latest member
Hanakoro

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