Home > Forum Home > Analyzing Corporate Financial Data > A requirement in Excel 2007 with SSAS cube > Change Pivot Table Field Selection with VBA macro Share

Change Pivot Table Field Selection with VBA macro

Excel Help for Change Pivot Table Field Selection With Vba Macro in Analyzing Corporate Financial Data


Forum TopicLogin

Change Pivot Table Field Selection With Vba Macro

Rate this:
(3/5 from 1 vote)
OopsYou could change the required pivot table field selections in multiple sheets from the values in the first sheet using some VBA code.
Assuming that the values chosen are in cell ranges in the first sheet, it would be a good idea to first name the ranges with the chosen values so that they can referenced easily.  If the values are within forms such as list boxes, you can use the MATCH and INDEX functions to return the selected value in a cell.
The VBA code then looks something as follows.
VBA Code:
Dim cellval1 As Variant
cellval1 = Range("namedrange1").Value
Sheets("sheetname1").PivotTables("pivottablename").PivotFields("pivotfieldname") = cellval1
It may be a good idea to first record a macro to change the pivot tables in order to get the correct code for to chnage the selection in each pivot table.

 Excel Business Forums Administrator
 Posted by on
 
View Full Post

Excel templates and solutions matched for Change Pivot Table Field Selection with VBA macro:

Solutions: Reorganize Data