gvreddyhr
02-11-2013, 01:52 AM
Hi,
Refer to above, I have excel which allows users to enter the data in range of A1:d(.xldown), when user update the data in a1:d1 then it should allow user to only edit a2:d2 and protect all ranges including a1:d1 from editing, request anyone of you to help me with the code.
Below is the code, can anyone help me in tweaking the same.
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:D1"))
aer.Users.Add "Power Users", True
ws.Protect "Excel2003"
End Sub
Thanks in advance
Regards,
GR
Refer to above, I have excel which allows users to enter the data in range of A1:d(.xldown), when user update the data in a1:d1 then it should allow user to only edit a2:d2 and protect all ranges including a1:d1 from editing, request anyone of you to help me with the code.
Below is the code, can anyone help me in tweaking the same.
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:D1"))
aer.Users.Add "Power Users", True
ws.Protect "Excel2003"
End Sub
Thanks in advance
Regards,
GR