Pinaceous
Well-known Member
- Joined
- Jun 11, 2014
- Messages
- 1,124
- Office Version
- 365
- Platform
- Windows
Good Day All,
I'm working with a sub that will protect the sheet with a password:
My question is, how do I write this specifically for a sheet and not the entire workbook?
For example, how would I apply this only to Worksheets(2)?
Please let me know.
Thank you!
Pinaceous
I'm working with a sub that will protect the sheet with a password:
VBA Code:
Sub ProtectSheets()
Dim ws As Worksheet
Dim pwd As String
pwd = "password" 'Put your password here
For Each ws In Worksheets
ws.Protect Password:=pwd
Next ws
End Sub
My question is, how do I write this specifically for a sheet and not the entire workbook?
For example, how would I apply this only to Worksheets(2)?
Please let me know.
Thank you!
Pinaceous