Sub AddEditRange()
Dim ws As Worksheet, ual As UserAccessList, aer As AllowEditRange, usr As UserAccess
Set ws = ThisWorkbook.Sheets("Protection")
ws.Unprotect "Excel2003"
Set aer = ws.Protection.AllowEditRanges.Add("Edit Range", Range("UserEditRange"), "pass1")
Set usr = aer.Users.Add("Power Users", True)
ws.Protect "Excel2003"
End Sub
|