Hi all, I had help creating a VB macro that is attached to buttons that will lock or unlock a workbook based on a macro-attached button press. I got the buttons to function the way they need to, the problem lies now that when I press "unprotect", the entire sheet is left vulnerable to formula & other structural changes when users need to add their data entry before pressing the "Protect" button. I want them to be able to save and lock their numbers, and they cannot be changed unless they ask me first. I hope im making sense. Basically I need help editing the lines in the attached code so instead of fully unprotecting the sheet, it unprotects only cells that I want to be able to be edited. Im not sure if this is possible, but I appreciate any and all help with this.
Here is the attached code:
I basically need the part that says "Sheet1.Unprotect PassWord" to be changed to something that will instead keep protection on everything besides data entry cells.
Here is the attached code:
VBA Code:
Option Explicit
Sub ProtectSheet()
Sheet1.Protect PassWord:="abc"
End Sub
Sub UnprotectSheet()
Dim PassWord As String, i As Integer
i = 0
Do
i = i + 1
If i > 5 Then
MsgBox "Password may only be entered 5 times. Application will now close."
Application.DisplayAlerts = False
ThisWorkbook.Saved = True
Application.Visible = False
Application.Quit
Exit Sub
End If
PassWord = InputBox("Enter Password (Accessable by admin only)")
Loop Until PassWord = "abc"
If PassWord = "abc" Then
Sheet1.Unprotect PassWord:="abc"
End If
End Sub
I basically need the part that says "Sheet1.Unprotect PassWord" to be changed to something that will instead keep protection on everything besides data entry cells.