ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macros/Protection/Pivot Tables...HELP (https://www.excelbanter.com/excel-discussion-misc-queries/115228-macros-protection-pivot-tables-help.html)

KDG

Macros/Protection/Pivot Tables...HELP
 
Thanks to someone on this forum, I received the following code to protect
many sheets within my document all at the same time. However, this doesn't
have the protection options written in that will allow the user to use the
pivot tables that are included on these sheets. Being very much the novice in
these things (boy, I'm learning a bunch from all of you gurus!) I need a
little help in where to include the portion of code that would turn on the
"allow" features in protecting the sheet. Help? Thank you sooooo much!

Public Sub ProtectSelectedSheets()
Dim MyPassword As String
Dim Sht As Worksheet
Dim ncProtect As New Collection
For Each Sht In ActiveWindow.SelectedSheets
ncProtect.Add Item:=Sht
Next Sht
MyPassword = "password"
Worksheets(1).Select
For Each Sht In ncProtect
Sht.Protect MyPassword
Next Sht
End Sub


All times are GMT +1. The time now is 01:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com