Sub LockCellsLive()
ActiveWorkbook.SAVE
Dim ProtectionArray(1, 3)
Dim aer As AllowEditRange
Dim x As Integer
ActiveSheet.Unprotect Password:="Lianne" 'Supply current password. If this macro has already been run, then enter the Master Password below
ProtectionArray(1, 1) = "Range1" 'Name
ProtectionArray(1, 2) = "(J:J,K:K,O:O,P:P,Q:Q,R:R)" 'Address
ProtectionArray(1, 3) = "Test" 'Password
For Each aer In ActiveSheet.Protection.AllowEditRanges
aer.Delete
Next aer
For x = 1 To UBound(ProtectionArray)
With ActiveSheet.Protection
.AllowEditRanges.Add Title:=ProtectionArray(x, 1), Range:=Range(ProtectionArray(x, 2)), Password:=ProtectionArray(x, 3)
End With
Next x
ActiveSheet.Protect Password:="Lianne", DrawingObjects:=True, Contents:=True, Scenarios:=True 'Password is the Master Password to unlock all cells.
End Sub
Bookmarks