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.
Bookmarks