Not sure if this is possible but what i want to do is as follows:
Unprotect sheet, refresh data on pivot table on sheet, filter out 3 items and then protect sheet.
However after the sheet is protected I want it to be editeable by a Slicer but the user cannot manually override any data in the pivot table.
Unprotect sheet, refresh data on pivot table on sheet, filter out 3 items and then protect sheet.
However after the sheet is protected I want it to be editeable by a Slicer but the user cannot manually override any data in the pivot table.
VBA Code:
Sub Protectandset()
Dim DialogMsg As Integer
Dim wb As Workbook
Dim ms As Worksheet
Dim st As Worksheet
Set wb = ActiveWorkbook
Set st = wb.Sheets("Source")
Set ms = wb.Sheets("Summary")
'emptyvalue = ""
ms.Unprotect ("password123")
Range("B4").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable1").PivotFields("Production Order Number"). _
ClearAllFilters
With ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"Production Order Number")
.PivotItems("").Visible = False
.PivotItems("(blank)").Visible = False
.PivotItems("Break").Visible = False
End With
' st.Unprotect ("password123")
ms.Protect ("password123")
' End If
End Sub