Hello friends,
I need a code to select the fields (Dates) in pivot (In Pivot- Value)
Example: Below code will add 7th and 8th Jan'18 field to PivotValue. But Next Week it should select 8th and 9th Jan'19 automatically instead of 7th and 8th.
Please help to get this fixed.
With Regards,
Aswinraj A
I need a code to select the fields (Dates) in pivot (In Pivot- Value)
Example: Below code will add 7th and 8th Jan'18 field to PivotValue. But Next Week it should select 8th and 9th Jan'19 automatically instead of 7th and 8th.
Please help to get this fixed.
Code:
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("7/1/2018"), "Sum of 7/1/2018", xlSum
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("8/1/2018"), "Sum of 8/1/2018", xlSum
With Regards,
Aswinraj A