Controling an Excel Pivot table filter from a cell value

Denised

New Member
Joined
Jun 11, 2003
Messages
5
I have a excel worksheet that is connect to an SQL Service Cube.

On one tab I have all my customers, what I was trying to do use copy the customer number into a cell that the product tab would then filter on all product sales sold to that customer.

I can get this to work if I am not pulling the data for the Cube, using a small subset of the data, but it does not work when using the cube.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)


If Intersect(Target, Range("C8")) Is Nothing Then Exit Sub


Dim pt As PivotTable
Dim Field As PivotField
Dim NewCat As String


Set pt = Worksheets("Product").PivotTables("ProductData")
Set Field = pt.PivotFields("Customer Name")
NewCat = Worksheets("Customer").Range("C8").Value

'This updates and refreshes the PIVOT table
With pt
Field.ClearAllFilters
Field.CurrentPage = NewCat
pt.RefreshTable
End With

End Sub


Does anyone have any ideas on have to get this to work against a cube?

Thanks!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,221,552
Messages
6,160,466
Members
451,649
Latest member
fahad_ibnfurjan

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