Results 1 to 3 of 3

Pivot Table(s) update macro workbook with locked sheets

Threaded View

  1. #1
    Registered User
    Join Date
    01-27-2015
    Location
    Southern Norway
    MS-Off Ver
    2010/2013 Std
    Posts
    17

    Pivot Table(s) update macro workbook with locked sheets

    Problem follows, hope it is Clear:
    -------------------------------------

    Sub UnprotectRefreshAll()
    Dim ws As Worksheet
    On Error Resume Next

    For Each ws In ActiveWorkbook.Worksheets
    ws.Unprotect Password:=""
    Next ws

    ActiveWorkbook.RefreshAll

    For Each ws In ActiveWorkbook.Worksheets
    ws.Protect Password:="", _
    AllowUsingPivotTables:=True
    Next ws

    End Sub

    ' 1. Getting error message on opening workbook, because:
    ' I have 2 (locked) sheets with different Pivot Tables based on same source data!
    ' NOTE All sheets are locked, not Workbook
    '
    ' BUT:
    ' 2. When I run this macro from an "Update" Button,in either of the Pivot sheets
    ' -the macros are executed despite the error message
    ' -but the last referenced sheet is opened! (ARTICLES)
    ' (Sheets CUSTOMER1-CUSTOMER2-TOTALS(Pivot)-ANALYSIS(Pivot)-CUSTOMERS-ARTICLES)
    ' "ARTICLES" is opening....

    ' 1. Don't understand, as the macro is executing anyway. ?
    ' 2. What I am missing is a substitute, or an addition to, "Next ws". ?
    ' 3. NOTE that macro is excecuting correct whwn RUN, but lands on last sheet from BUTTON.
    Last edited by torers; 06-11-2015 at 11:10 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. vba code to update all pivot table in workbook but file size is ( 100 mb )
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2014, 06:23 AM
  2. Can you update a pivot table using a drop-down without a macro?
    By somedudeonline in forum Excel General
    Replies: 0
    Last Post: 07-23-2013, 06:16 PM
  3. Replies: 3
    Last Post: 06-28-2010, 04:28 AM
  4. Update Pivot Table with New Sheets
    By WRPCWill in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2008, 10:57 PM
  5. how to update a pivot table on shared workbook
    By EED in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2005, 09:05 AM

Tags for this Thread

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