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
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