PDA

View Full Version : get value of cell for pivot table



Sir Babydum GBE
04-25-2008, 04:50 AM
I know I can't use a named cell in a pivot table calculated field.

But how do I get a macro to refresh a pivot table, and while it's at it, update the calculated field called "target" usiing the value in a cell named TG?

So where the code says:
ActiveSheet.PivotTables("PivotTable3").CalculatedFields("Target"). _
StandardFormula = "=12.17%"

I want the code to change the 12.17% to whatever value is in the cell named TG.

Thanks

rory
04-25-2008, 05:04 AM
Something like:


With ActiveSheet.PivotTables("PivotTable3")
.CalculatedFields("Target").StandardFormula = "=" & Range("TG").Value
.RefreshTable
End With

Sir Babydum GBE
04-25-2008, 05:24 AM
Something like:


With ActiveSheet.PivotTables("PivotTable3")
.CalculatedFields("Target").StandardFormula = "=" & Range("TG").Value
.RefreshTable
End With


Thanks Rory - fab!