View Single Post
  #3   Report Post  
tjtjjtjt
 
Posts: n/a
Default

Something like this should get you started. Note that the AllowPivotTables
part will only work in Excel 2002 or 2003. Leave it out if you are using 2000
or earlier or if you do not want people to be anble to change the PivotTable
structure.

This macro assumes the password assigned to the Worksheet is 12345. If you
don't have a password, you can leave that part off. Also, the name of your
PivotTable is likely not PivotTable5 (as the one below is). To find the name
of your PivotTable, Right-Click on it and choose Table Options.

tj

Sub RefreshPivotTable()

ActiveSheet.Unprotect 12345
ActiveSheet.PivotTables("PivotTable5").PivotCache. Refresh
ActiveSheet.Protect 12345, AllowUsingPivotTables:=True

End Sub


"Saariko" wrote:

I guess the subject says it all. I have a pivottable I want to lock the
worksheet it's in. but still keep the refresh data button available.

Which of the functions should do it? I tried them all with no success.

Saariko