PDA

View Full Version : avoid "error 400"



miatch
07-03-2009, 01:56 AM
I'm trying to update my pivot-tables with a macro,how can I avoid error400? here is my code:

Sub RefreshPivotTables()
Dim pivotTable As pivotTable
For Each pivotTable In ActiveSheet.PivotTables
pivotTable.RefreshTable
Next
End Sub

Can anybody help me with that?

Bob Phillips
07-03-2009, 02:21 AM
I use


Activeworkbook.Refreshall

miatch
07-03-2009, 03:12 AM
how can I make this run in a protected workbook?

Bob Phillips
07-03-2009, 03:47 AM
Unprotect it in code, run that, then protect it after.