A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi
Add the following line of code just before End Sub:
Sheets("Pivots").Unprotect Password:="1234"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I have a file with several sheets. I need to protect all sheets except one (in which I have few pivot tables that users should be able to refresh) and in addition, the users should be able to expand/collapse columns and rows in the protected sheets.
This code works to protect all workbook while expanding/collapsing. The problem is that I do know know how to unlock the sheet "Pivots" to let the users refresh some pivot tables.
Private Sub Workbook_Open()
Dim objHoja As Worksheet
For Each objHoja In ThisWorkbook.Sheets
With objHoja
.Protect Password:="1234", userinterfaceonly:=True, _
AllowFiltering:=True
.EnableOutlining = True
End With
Next
End Sub
Any help will be more than welcome!
Marisol
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Hi
Add the following line of code just before End Sub:
Sheets("Pivots").Unprotect Password:="1234"
You're welcome. Feel free to Mark as Answer so this can be re-used sooner or later...
Hi Lz.
This is exactly what I needed! Thank you so much!!!