Hi Issa,
For the following code to work, you need to make some changes to your sheet.
Delete the "Allow user to edit range".
Now select the ranges you want users to be able to adjust (P11:P20,R11:X20).
Right-click, cell properties, protection tab and uncheck protection.
Goto topmenu, extra, protection, protect sheet.
Now you basicly got what you already had.
Now right-click the sheets tab and select view code.
Paste the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cRow As Integer
If Intersect(Target, Range("R11:R20")) Is Nothing Then Exit Sub
If Target.Value = 3 Or Target.Value = 4 Then
ActiveSheet.Unprotect
cRow = Target.Row
Range(Cells(cRow, "T"), Cells(cRow, "U")).Locked = True
ActiveSheet.Protect
End If
If Target.Value = 1 Or Target.Value = 2 Then
ActiveSheet.Unprotect
cRow = Target.Row
Range(Cells(cRow, "T"), Cells(cRow, "U")).Locked = False
ActiveSheet.Protect
End If
End Sub
Now test the result by changing the value of range R11:R20 from 1 or 2 to 3 or 4 and back.
Will this work for you?
Best regards,
Trowa
Thanks a lot, I appreciate all your assistance.
It workes excellent, great :)
Thank you again.