Add user edit range : Worksheet Protection « Excel « VBA / Excel / Access / Word






Add user edit range

 

Sub AddUserEditRange()
    Dim ws As Worksheet, aer As AllowEditRange
    Set ws = ThisWorkbook.Sheets("Protection")
    ws.Unprotect "Excel2003"
    Set aer = ws.Protection.AllowEditRanges.Add("User Range", ws.Range("A1:D4"))
    aer.Users.Add "Power Users", True
    ws.Protect "Excel2003"
End Sub

 








Related examples in the same category

1.Add protection to Worksheet
2.Protect Sheet
3.Unprotect worksheet
4.Show Protection Properties
5.remove user
6.Remove user edit range
7.Formulas Protection
8.Protecting Worksheet Assets with the Protect Method