noetic76
05-11-2015, 10:23 PM
Heya!
I have a pivot table that is accessing a table with numerators and denominators for calculation of several measures. I want users to be able to click on a button to select the measure they wish to see, after they have selected some filters from a couple of slicers.
I've got the code that selects the measure for the pivot table values, but I need to clear the value that's in the table first. I could use the "Clear All" functionality in the PivotTable Tools, but that clears the filters too.
Here's the code for the measure selection, can you help me to add a bit at the beginning that clears the value currently in the pivot table please?
Sub measure()
ActiveSheet.PivotTables("es1").AddDataField ActiveSheet.PivotTables("es1"). _
PivotFields("total waiting"), "Sum of total waiting", xlSum
With ActiveSheet.PivotTables("es1").PivotFields("Sum of total waiting")
.NumberFormat = "#,##0"
End With
End Sub
Thanks all!
Ruth
I have a pivot table that is accessing a table with numerators and denominators for calculation of several measures. I want users to be able to click on a button to select the measure they wish to see, after they have selected some filters from a couple of slicers.
I've got the code that selects the measure for the pivot table values, but I need to clear the value that's in the table first. I could use the "Clear All" functionality in the PivotTable Tools, but that clears the filters too.
Here's the code for the measure selection, can you help me to add a bit at the beginning that clears the value currently in the pivot table please?
Sub measure()
ActiveSheet.PivotTables("es1").AddDataField ActiveSheet.PivotTables("es1"). _
PivotFields("total waiting"), "Sum of total waiting", xlSum
With ActiveSheet.PivotTables("es1").PivotFields("Sum of total waiting")
.NumberFormat = "#,##0"
End With
End Sub
Thanks all!
Ruth