ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Password protecting certain worksheets in a file (https://www.excelbanter.com/excel-discussion-misc-queries/19620-password-protecting-certain-worksheets-file.html)

Mike

Password protecting certain worksheets in a file
 
How do I set passwords to protect just certain worksheets
in a file?

JE McGimpsey

If you mean worksheet passwords, one way:

Public Sub ProtectSomeButNotAll()
Const sPWORD As String = "drowwsap"
Dim vSheets As Variant
Dim i As Long
vSheets = Array("Sheet1", "Sheet3", "Sheet5")
For i = LBound(vSheets) To UBound(vSheets)
Worksheets(vSheets(i)).Protect sPWORD
Next i
End Sub


In article ,
"Mike" wrote:

How do I set passwords to protect just certain worksheets
in a file?



All times are GMT +1. The time now is 03:23 PM.

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