CellValues in Separate Worksheet AutoSelects PivotTable Items via VBA

Victerus

New Member
Joined
Mar 12, 2009
Messages
1
Hello Everyone,
I have a question regarding pivot tables and VBAs and I hope one of you all can help me. Essentially what I am trying to do is auto-select the dropdown items in a pivot table, by double-clicking a cell in another flatfile worksheet. This file contains only those combinations of fields that the user should utilize in the final pivot. The last column/field (column I) is where the user will double-click to lead them to the fully generated pivot based upon the preceding predefined string of data. So basically, the user will access the flat file "menu," find the row that pertains to their inquiry, then double-click the last column cell in the row to "generate" the pivot. I have (3) page fields in the final pivot. The first page field should link to Column A in the flatfile, the second page field to Column C, and the last page field corresponds to Column D (thus linking up the two documents). Any bright ideas?


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("I" & ActiveCell.Row)) Is Nothing Then
Else
Sheets("PivotReport_Product Menu").Select
ActiveSheet.PivotTables("PivotTable2").PivotFields("Product Group Code"). _
CurrentPage = Worksheets("Product Lookup").Range("A" & ActiveCell.Row).Value
ActiveSheet.PivotTables("PivotTable2").PivotFields("Dose Form").CurrentPage = _
Worksheets("Product Lookup").Range("C" & ActiveCell.Row).Value
ActiveSheet.PivotTables("PivotTable2").PivotFields("Strength or Concentration") _
.CurrentPage = Worksheets("Product Lookup").Range("D" & ActiveCell.Row).Value
End If

End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,203,240
Messages
6,054,317
Members
444,717
Latest member
melindanegron

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