+ Reply to Thread
Results 1 to 3 of 3

Refresh pivot tables - "Error: Cannot update PT on protect sheet" (sheet not protexted)

Hybrid View

  1. #1
    Registered User
    Join Date
    05-24-2013
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    6

    Refresh pivot tables - "Error: Cannot update PT on protect sheet" (sheet not protexted)

    Dear all,

    I recorded/edited the following code to update some pivot tables on hidden/protected sheets. The code worked fine, but suddenly I get an error that "I cannot update pivot tables on a protected sheet" (see line in bold). However, this sheet is only hidden (not protected). I already included a line to unprotect it (even it's not protected), but I keep getting the same error message.

    Can someone help me on this and explain what i did wrong?

    Kind regards,

    Bart

    Sub UpdateActuals()
    '
    ' UpdateActuals Macro
    '

    ActiveSheet.Unprotect Password:="otsa"
    Sheets("pivots TT actuals (1)").Visible = True
    Sheets("pivots TT actuals (2)").Visible = True
    Sheets("Pivots TT actuals (1)").Select
    Sheets("pivots TT actuals (1)").Unprotect Password:="otsa"
    Sheets("pivots TT actuals (2)").Unprotect Password:="otsa"
    ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
    ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
    ActiveSheet.PivotTables("PivotTable5").PivotCache.Refresh
    Sheets("Pivots TT actuals (2)").Select
    ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
    Sheets("Overzicht TT - Actuals & KPI").Select
    ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
    ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
    Rows("61:69").Select
    Selection.EntireRow.Hidden = True
    Range("I15").Select
    Sheets("pivots TT actuals (1)").Visible = False
    Sheets("pivots TT actuals (2)").Visible = False
    ActiveSheet.protect Password:="otsa"
    End Sub
    Last edited by BartSeli; 08-15-2013 at 11:14 AM.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Refresh pivot tables - "Error: Cannot update PT on protect sheet" (sheet not protexted

    do you have another pivot table on a still protected sheet that uses the same cache?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    05-24-2013
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Refresh pivot tables - "Error: Cannot update PT on protect sheet" (sheet not protexted

    This was indeed the problem! Ptretty weird because the code was working properly before (nothing has changed). Wrote code to unprotect the other sheets and now everything is backt to normal again.

    Thanks for the help!

    Kind regards,

    Bart

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 05-31-2013, 05:16 AM
  2. [SOLVED] Macro Sheet Protect Error Due to This Sub NextScreening() Range("C2").Value = Range("C
    By cychua in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 09-29-2012, 04:51 AM
  3. Macro won't wait "Refresh all Pivot Tables" command to conclude before calculating
    By malalol in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-23-2010, 04:31 PM
  4. Replies: 6
    Last Post: 12-21-2005, 07:20 PM
  5. Excel 2002 "Protect Sheet", but allow "Hide Columns"?
    By Dave Peterson in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 12:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1