All2Cheesy
Board Regular
- Joined
- Mar 4, 2015
- Messages
- 127
Hi all,
I've currently got a macro which locks all sheets in a workbook, although certain cells remain editable. (See below)
What I'll need to do is create a second macro, which locks every cell in every sheet of a workbook, without interfering with the functionality of the first lock.
Is this possible? Or might there be another way to go about this?
Assistance would be greatly appreciated.
I've currently got a macro which locks all sheets in a workbook, although certain cells remain editable. (See below)
What I'll need to do is create a second macro, which locks every cell in every sheet of a workbook, without interfering with the functionality of the first lock.
Is this possible? Or might there be another way to go about this?
Assistance would be greatly appreciated.
Code:
Sub SalesManagerLock()
Dim S As Object
Dim pWord1 As String, pWord2 As String
pWord1 = InputBox("Please Enter the password")
If pWord1 = "" Then Exit Sub
pWord2 = InputBox("Please re-enter the password")
If pWord2 = "" Then Exit Sub
'make certain passwords are identical
If InStr(1, pWord2, pWord1, 0) = 0 Or _
InStr(1, pWord1, pWord2, 0) = 0 Then
MsgBox "You entered different passwords. No action taken"
Exit Sub
End If
For Each Worksheet In Worksheets
Worksheet.Protect Password:=pWord1
Next
End Sub