Claymationator
Well-known Member
- Joined
- Sep 26, 2006
- Messages
- 705
I am currently using some code to protect a worksheet, and want to be able to have an option to turn it on or off so that the main user can make changes to the form if necessary.
The reason that I am going this route is that the user has to copy and paste a selection from the sheet into the body of an email, and if I just use the regular sheet protection (Protect Sheet under the Review tab) the user isn't able to make any type of selection because the cells are locked.
Any help is appreciated!
The reason that I am going this route is that the user has to copy and paste a selection from the sheet into the body of an email, and if I just use the regular sheet protection (Protect Sheet under the Review tab) the user isn't able to make any type of selection because the cells are locked.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Locked = True Then
Me.Protect 'Password:="Secret"
Else
Me.Unprotect 'Password:="Secret"
End If
End Sub
Any help is appreciated!